Re: Linux 4.15-rc6
From: Willy Tarreau
Date: Thu Jan 04 2018 - 05:27:16 EST
On Wed, Jan 03, 2018 at 01:20:00PM -0800, Andres Freund wrote:
> On 2018-01-03 13:57:25 +0100, Willy Tarreau wrote:
> > I think we should start to think about an option to
> > disable this per process. We could imagine for example a prctl()
> > requiring CAP_SYS_ADMIN to disable it. This would at least allow
> > processes started as root to disable it when they consider themselves
> > irrelevant to this kind of protection (mostly I/O intensive or network
> > intensive applications).
>
> That might not be a bad idea. If so, it'd be a good idea to keep it
> separate from CAP_SYS_ADMIN. E.g. postgres refuses to run as root,
There's a difference between "running as" and "starting as" (eg in
haproxy we encourage to *start as root* but not to *run as root*, this
allows the process to chroot to /var/empty and drop all privileges).
But I get your point, it's important to adapt to what various programs
will require.
> but
> setcap'ing to allow CAP_SYS_LIVE_AND_LET_LIVE_SYSCALL or such would
> work.
yes probably.
> But I suspect this isn't something easily done on a capability/prctl
> level? Seems not uncomplicated to change this after a process has
> already been created - so maybe it'd be easier to force this via
> personality()?
I don't know. One solution when you perform changes that effect the
running process' VMA is to re-exec itself after the change :
if (pti_protection_enabled && prctl(PR_SET_PTI, PR_PTI_DISABLE) == 0)
exit(execve(argv[0], argv, envp));
> > > > This isn't a complaint, I just thought it might be useful
> > > > information. If it helps for anything/anybody, I'm happy to run
> > > > additional benchmarks / provide additional information.
> > >
> > > Note that it will depend heavily on the hardware too. Older CPU's
> > > without PCID will be impacted more by the isolation.
> >
> > Interesting. This CPU has PCID, so it's possible that older hardware
> > may indeed be hit a bit more.
>
> The post linked above has numbers with nopcid disabling pcid use, and
> indeed, the difference is quite measurable.
I'm going to re-run the tests on an Atom C2518 now, which doesn't have pcid,
I don't even know if it's affected by the issue.
Cheers,
Willy