History

Merge tag 'kernel.sys.v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

Pull set_user() update from Christian Brauner: "This contains a single fix to set_user() which aligns permission checks with the corresponding fork() codepath. No one involved in this could come up with a reason for the difference. A capable caller can already circumvent the check when they fork where the permission checks are already for the relevant capabilities in addition to also allowing to exceed nproc when it is the init user. So apply the same logic to set_user()" * tag 'kernel.sys.v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux: set_user: add capability check when rlimit(RLIMIT_NPROC) exceeds

Linus Torvalds committed 5 years ago

Commit e55f0c42 parents 67b03f9 28636431 file · +2 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sys.c+2−1
@@ -480,7 +480,8 @@ static int set_user(struct cred *new) · 479 unmodified lines
480 * failure to the execve() stage.480 * failure to the execve() stage.
481 */481 */
482 if (is_ucounts_overlimit(new->ucounts, UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC)) &&482 if (is_ucounts_overlimit(new->ucounts, UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC)) &&
483 new_user != INIT_USER)483 new_user != INIT_USER &&
484 !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN))
484 current->flags |= PF_NPROC_EXCEEDED;485 current->flags |= PF_NPROC_EXCEEDED;
485 else486 else
486 current->flags &= ~PF_NPROC_EXCEEDED;487 current->flags &= ~PF_NPROC_EXCEEDED;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t