Re: [RFC PATCH v7 11/26] userland: Track init lifecycle via copy_process() and pid_namespace

From: bot+bpf-ci

Date: Sun Nov 22 2026 - 15:09:31 EST


> userland: Track init lifecycle via copy_process() and pid_namespace

TL;DR: Nits only: userland_copy() has an unused tsk argument, and the
rcu_read_lock()/unlock() pair around task_uid() in userland_exit() may be
redundant.

> diff --git a/kernel/userland.c b/kernel/userland.c
> --- a/kernel/userland.c
> +++ b/kernel/userland.c

[ ... ]

> +void userland_copy(struct task_struct *tsk, struct pid *pid, struct userland *c)
> +{
> + if (likely(!c || !is_child_reaper(pid)))
> + return;
> +

This isn't a bug, but is the tsk argument of userland_copy() needed? It
is not referenced in the body, which uses only pid and c. Could the
prototype take just the pid and the userland?

[ ... ]

> +void userland_exit(struct pid_namespace *pid_ns, struct task_struct *tsk)
> +{
[ ... ]
> + leader = tsk->group_leader;
> + rcu_read_lock();
> + uid = task_uid(leader);
> + rcu_read_unlock();

This isn't a bug, but since task_uid() already takes rcu_read_lock()
itself, could the surrounding rcu_read_lock()/rcu_read_unlock() pair be
dropped?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45063222848