mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Andres Freund <andres@anarazel.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Linux 4.15-rc6
Date: Thu, 4 Jan 2018 11:27:04 +0100	[thread overview]
Message-ID: <20180104102704.GB3235@1wt.eu> (raw)
In-Reply-To: <20180103212000.zvll6xvgj3idysgd@alap3.anarazel.de>

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

  reply	other threads:[~2018-01-04 10:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-31 22:57 Linus Torvalds
2018-01-02 20:28 ` Andres Freund
2018-01-02 21:09   ` Linus Torvalds
2018-01-03 12:57     ` Willy Tarreau
2018-01-03 21:20       ` Andres Freund
2018-01-04 10:27         ` Willy Tarreau [this message]
2018-01-04 11:03           ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180104102704.GB3235@1wt.eu \
    --to=w@1wt.eu \
    --cc=andres@anarazel.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®