pidns: fix set/getpriority and ioprio_set/get in PRIO_USER mode
authorBen Segall <[email protected]>
Sat, 7 Nov 2015 00:32:48 +0000 (16:32 -0800)
committerLinus Torvalds <[email protected]>
Sat, 7 Nov 2015 01:50:42 +0000 (17:50 -0800)
commit8639b46139b0e4ea3b1ab1c274e410ee327f1d89
treeef62c65fa87b03133678a76aba7a6e50a24a2c0d
parentde90a6bcaede81f35e8caf4566d1006267230377
pidns: fix set/getpriority and ioprio_set/get in PRIO_USER mode

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.

Eric said:

: 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.

Signed-off-by: Ben Segall <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Ambrose Feinstein <[email protected]>
Acked-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
block/ioprio.c
kernel/sys.c