From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753129AbbI1XAM (ORCPT ); Mon, 28 Sep 2015 19:00:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53599 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750901AbbI1XAK (ORCPT ); Mon, 28 Sep 2015 19:00:10 -0400 Date: Mon, 28 Sep 2015 16:00:09 -0700 From: Andrew Morton To: ebiederm@xmission.com (Eric W. Biederman) Cc: bsegall@google.com, linux-kernel@vger.kernel.org, Oleg Nesterov , Al Viro , Linux Containers , ambrose@google.com Subject: Re: [PATCH] pidns: fix set/getpriority and ioprio_set/get in PRIO_USER mode Message-Id: <20150928160009.3a44a8a23a6bbdca2a0b9a57@linux-foundation.org> In-Reply-To: <87r3lnkqs3.fsf@x220.int.ebiederm.org> References: <20150917142926.1a68072b19ef0ada47eabe43@linux-foundation.org> <874minis1b.fsf@x220.int.ebiederm.org> <87r3lnkqs3.fsf@x220.int.ebiederm.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Sep 2015 00:32:28 -0500 ebiederm@xmission.com (Eric W. Biederman) wrote: > bsegall@google.com writes: > > > ebiederm@xmission.com (Eric W. Biederman) writes: > > > >> Andrew Morton writes: > >> > >>> On Wed, 16 Sep 2015 12:58:04 -0700 bsegall@google.com wrote: > >>> > >>>> setpriority(PRIO_USER, 0, x) will change the priority of tasks outside > >>>> of the current pid namespace. This is in contrast to both the other > >>>> modes of setpriority and the example of kill(-1). Fix this. getpriority > >>>> and ioprio have the same failure mode, fix them too. > >>> > >>> (cc Eric) > >> (cc Containers) > >> > >> Interesting. Strictly speaking the current behavior is not wrong. > >> Searching for all threads with a given uid has nothing to do with pids > >> so the pid namespace not limiting them is natural. > >> > >> In practice I don't think anyone cares either way (except people with > >> one color or another of security hat on) so this might be a change we > >> can actually make. > >> > >> In general it is probably better not to share uids and gids between > >> containers. > >> > >> Ben do you have a use case where this actually matters? Or was this a > >> case of "That looks wrong..."? > >> > >> Eric > > > > I believe we generally want this for isolation of a process, without > > requiring root initially (and a non-trivial uid_map, not to mention > > creating the extra users, requires root). There are probably other holes > > in using namespaces like this, but are they intended? > > After some more thinking about it this patch sounds justifiable. > > My goal with namespaces is not to build perfect isolation mechanisms > as that can get into ill defined territory, but to build well defined > mechanisms. And to handle the corner cases so you can use only > a single namespace with well defined results. > > In this case you have found the two interfaces I am aware of that > identify processes by uid instead of by pid. Which quite frankly is > weird. Unfortunately the weird unexpected cases are hard to handle > in the usual way. > > I was hoping for a little more information. Changes like this one we > have to be careful of because someone might be depending on the current > behavior. I don't think they are and I do think this make sense as part > of the pid namespace. > > Acked-by: "Eric W. Biederman" My copy of the getpriority/setpriority manpage doesn't mention interaction with namespaces at all. Should it do so?