[Devel] [PATCH vz7 2/6] userns: initiallize user_init_ns earlier
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Thu Sep 28 21:19:48 MSK 2023
user_namespaces_init was converted from module_init
to subsys_initcall which is called at later point.
init_user_ns is used before that call in sget(...).
So move the initialization of ucount_max into the
declaration of init_user_ns.
https://jira.vzint.dev/browse/PSBM-151029
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
kernel/user.c | 4 ++++
kernel/user_namespace.c | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/user.c b/kernel/user.c
index de59631d163b..fdcf675b809d 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -59,6 +59,10 @@ struct user_namespace init_user_ns = {
.persistent_keyring_register_sem =
__RWSEM_INITIALIZER(init_user_ns.persistent_keyring_register_sem),
#endif
+ /* To make user namespaces something to opt in to for existing
+ * RHEL users default ucount_max to 0.
+ */
+ .ucount_max[UCOUNT_USER_NAMESPACES] = 0,
};
EXPORT_SYMBOL_GPL(init_user_ns);
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 1759671e62ad..a76d0a796aa9 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -1119,10 +1119,6 @@ const struct proc_ns_operations userns_operations = {
static __init int user_namespaces_init(void)
{
user_ns_cachep = KMEM_CACHE(user_namespace, SLAB_PANIC | SLAB_ACCOUNT);
- /* To make user namespaces something to opt in to for existing
- * RHEL users default ucount_max to 0.
- */
- init_user_ns.ucount_max[UCOUNT_USER_NAMESPACES] = 0;
return 0;
}
subsys_initcall(user_namespaces_init);
--
2.39.3
More information about the Devel
mailing list