mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
Merge branch 'for-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull ucount fixes from Eric Biederman: "This branch fixes a regression that made it impossible to increase rlimits that had been converted to the ucount infrastructure, and also fixes a reference counting bug where the reference was not incremented soon enough. The fixes are trivial and the bugs have been encountered in the wild, and the fixes have been tested" * 'for-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: ucounts: Increase ucounts reference counter before the security hook ucounts: Fix regression preventing increasing of rlimits in init_user_ns
This commit is contained in:
commit
62add98208
2 changed files with 10 additions and 10 deletions
|
@ -286,13 +286,13 @@ struct cred *prepare_creds(void)
|
||||||
new->security = NULL;
|
new->security = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
new->ucounts = get_ucounts(new->ucounts);
|
new->ucounts = get_ucounts(new->ucounts);
|
||||||
if (!new->ucounts)
|
if (!new->ucounts)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
validate_creds(new);
|
validate_creds(new);
|
||||||
return new;
|
return new;
|
||||||
|
|
||||||
|
@ -753,13 +753,13 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon)
|
||||||
#ifdef CONFIG_SECURITY
|
#ifdef CONFIG_SECURITY
|
||||||
new->security = NULL;
|
new->security = NULL;
|
||||||
#endif
|
#endif
|
||||||
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
new->ucounts = get_ucounts(new->ucounts);
|
new->ucounts = get_ucounts(new->ucounts);
|
||||||
if (!new->ucounts)
|
if (!new->ucounts)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
put_cred(old);
|
put_cred(old);
|
||||||
validate_creds(new);
|
validate_creds(new);
|
||||||
return new;
|
return new;
|
||||||
|
|
|
@ -828,10 +828,10 @@ void __init fork_init(void)
|
||||||
for (i = 0; i < MAX_PER_NAMESPACE_UCOUNTS; i++)
|
for (i = 0; i < MAX_PER_NAMESPACE_UCOUNTS; i++)
|
||||||
init_user_ns.ucount_max[i] = max_threads/2;
|
init_user_ns.ucount_max[i] = max_threads/2;
|
||||||
|
|
||||||
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_NPROC, task_rlimit(&init_task, RLIMIT_NPROC));
|
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_NPROC, RLIM_INFINITY);
|
||||||
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_MSGQUEUE, task_rlimit(&init_task, RLIMIT_MSGQUEUE));
|
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_MSGQUEUE, RLIM_INFINITY);
|
||||||
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_SIGPENDING, task_rlimit(&init_task, RLIMIT_SIGPENDING));
|
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_SIGPENDING, RLIM_INFINITY);
|
||||||
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_MEMLOCK, task_rlimit(&init_task, RLIMIT_MEMLOCK));
|
set_rlimit_ucount_max(&init_user_ns, UCOUNT_RLIMIT_MEMLOCK, RLIM_INFINITY);
|
||||||
|
|
||||||
#ifdef CONFIG_VMAP_STACK
|
#ifdef CONFIG_VMAP_STACK
|
||||||
cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "fork:vm_stack_cache",
|
cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "fork:vm_stack_cache",
|
||||||
|
|
Loading…
Add table
Reference in a new issue