Re: [PATCH 0/8] ucounts: RLIMIT_NPROC fixes

From: Michal Koutný
Date: Tue Feb 15 2022 - 06:37:54 EST


On Fri, Feb 11, 2022 at 11:22:13AM -0700, Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> wrote:
> Do we need updates to selftests - Michal's patch series included changes to
> selftests/exec

In my understanding the original rlimits-per-userns.c covers an invalid
use case -- clone(0);setuid();unshare(CLONE_NEWUSER) -- where the
created user_ns is owned by unprivileged user and the global
RLIMIT_NPROC cannot be breached.

My patched variant retains this use-case (should fail) and adds
clone(CLONE_NEWUSER);setuid() [1] variant which should be the valid
use-case for per-user per-user-ns RLIMIT_NPROC.

Michal

[1] In this situation theoretically equivalent to clone(0);unshare(CLONE_NEWUSER);setuid().