Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752686AbeADK1N (ORCPT + 1 other); Thu, 4 Jan 2018 05:27:13 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:38173 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752159AbeADK1M (ORCPT ); Thu, 4 Jan 2018 05:27:12 -0500 Date: Thu, 4 Jan 2018 11:27:04 +0100 From: Willy Tarreau To: Andres Freund Cc: Linus Torvalds , Linux Kernel Mailing List Subject: Re: Linux 4.15-rc6 Message-ID: <20180104102704.GB3235@1wt.eu> References: <20180102202859.4fvvrtngnitwzfym@alap3.anarazel.de> <20180103125724.GA2189@1wt.eu> <20180103212000.zvll6xvgj3idysgd@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180103212000.zvll6xvgj3idysgd@alap3.anarazel.de> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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