Re: [PATCH v3 11/70] ns: add active reference count
From: Simon Horman
Date: Tue Oct 28 2025 - 06:30:13 EST
On Fri, Oct 24, 2025 at 12:52:40PM +0200, Christian Brauner wrote:
...
> diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
...
> +void get_cred_namespaces(struct task_struct *tsk)
> +{
> + ns_ref_active_get(tsk->real_cred->user_ns);
Hi Christian,
real_cred is protected by RCU, but this code doesn't seem to take
that into account. Or, at least Sparse doesn't think so:
.../nsproxy.c:264:9: error: no generic selection for 'struct user_namespace *const [noderef] __rcu user_ns'
.../nsproxy.c:264:9: warning: dereference of noderef expression
> +}
> +
> +void exit_cred_namespaces(struct task_struct *tsk)
> +{
> + ns_ref_active_put(tsk->real_cred->user_ns);
Likewise here.
> +}
> +
> int exec_task_namespaces(void)
> {
> struct task_struct *tsk = current;
...