]> git.baikalelectronics.ru Git - kernel.git/commit
ucounts: Move RLIMIT_NPROC handling after set_user
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 14 Feb 2022 15:40:25 +0000 (09:40 -0600)
committerEric W. Biederman <ebiederm@xmission.com>
Thu, 17 Feb 2022 15:11:26 +0000 (09:11 -0600)
commita3f16a50f52aa8d7e32572896eb174700da56555
treee0992ba2c64368b66a5d19f87c3b99c136ec6dcd
parent3402d38e0ee0e9fa1383d4accf5144c68318782c
ucounts: Move RLIMIT_NPROC handling after set_user

During set*id() which cred->ucounts to charge the the current process
to is not known until after set_cred_ucounts.  So move the
RLIMIT_NPROC checking into a new helper flag_nproc_exceeded and call
flag_nproc_exceeded after set_cred_ucounts.

This is very much an arbitrary subset of the places where we currently
change the RLIMIT_NPROC accounting, designed to preserve the existing
logic.

Fixing the existing logic will be the subject of another series of
changes.

Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20220216155832.680775-4-ebiederm@xmission.com
Fixes: 0575577973b8 ("Reimplement RLIMIT_NPROC on top of ucounts")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/sys.c