linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND RFC PATCH 0/1] CAP_SYS_NICE inside user namespace
@ 2019-11-18 17:01 Prakash Sangappa
  2019-11-18 17:01 ` [RESEND RFC PATCH 1/1] Selectively allow CAP_SYS_NICE capability inside user namespaces Prakash Sangappa
  2019-11-18 19:36 ` [RESEND RFC PATCH 0/1] CAP_SYS_NICE inside user namespace Jann Horn
  0 siblings, 2 replies; 11+ messages in thread
From: Prakash Sangappa @ 2019-11-18 17:01 UTC (permalink / raw)
  To: linux-kernel, linux-api; +Cc: ebiederm, tglx, peterz, serge, prakash.sangappa

Some of the capabilities(7) which affect system wide resources, are ineffective
inside user namespaces. This restriction applies even to root user( uid 0)
from init namespace mapped into the user namespace. One such capability
is CAP_SYS_NICE which is required to change process priority. As a result of
which the root user cannot perform operations like increase a process priority
using -ve nice value or set RT priority on processes inside the user namespace.
A workaround to deal with this restriction is to use the help of a process /
daemon running outside the user namespace to change process priority, which is
a an inconvenience.

We could allow these restricted capabilities to take effect only for the root
user from init namespace mapped inside a user namespace and limit the effect
with use of cgroups. It would seem reasonable to deal with each of these
restricted capabilities on a case by case basis and address them. This patch
is concerning CAP_SYS_NICE capability. The proposal here is to selectively
allow CAP_SYS_NICE to take effect inside user namespace only for a root user
mapped from init name space. 

Which user id gets to map the root user(uid 0) from init namespace inside its
user namespaces is authorized thru /etc/subuid & /etc/subgid entries. Only
system admin / root user on the system can add these entries.
Therefore any ordinary user cannot simply map the root user(uid 0) into
user namespaces created. Necessary cgroup bandwidth control can be used
to limit cpu usage for such user namespaces.

The capabilities(7) manpage lists all the operations / system calls that are
subject to CAP_SYS_NICE capability check. This patch currently allows
CAP_SYS_NICE to take effect inside a user namespace only for system calls
affecting process priority. For completeness sake should memory
operations(migrate_pages(2), move_pages(2), mbind(2)) mentioned in the
manpage, also be permitted? There are no cgroup controls to limit the effect
of these memory operations.

Looking for feedback on this approach.

Prakash Sangappa (1):
  Selectively allow CAP_SYS_NICE capability inside user namespaces

 kernel/sched/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-01-08 21:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 17:01 [RESEND RFC PATCH 0/1] CAP_SYS_NICE inside user namespace Prakash Sangappa
2019-11-18 17:01 ` [RESEND RFC PATCH 1/1] Selectively allow CAP_SYS_NICE capability inside user namespaces Prakash Sangappa
2019-11-18 19:30   ` Jann Horn
2019-11-19  0:46     ` prakash.sangappa
2019-11-21 21:27   ` Eric W. Biederman
2019-11-22  1:45     ` Prakash Sangappa
2020-01-08 21:23       ` prakash.sangappa
2019-11-18 19:36 ` [RESEND RFC PATCH 0/1] CAP_SYS_NICE inside user namespace Jann Horn
2019-11-18 20:34   ` Prakash Sangappa
2019-11-21 18:33     ` Enrico Weigelt, metux IT consult
2019-11-22  1:54       ` Prakash Sangappa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).