Re: [RFC PATCH v6 12/26] userland: Add userland_open() system call

From: bot+bpf-ci

Date: Sat Nov 21 2026 - 21:13:50 EST


> userland: Add userland_open() system call

TL;DR: Nit only: the current->nsproxy NULL check and -EOPNOTSUPP return in
userland_open() look unnecessary, since unshare() and setns() don't test it;
could it be dropped?

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

[ ... ]

> +SYSCALL_DEFINE1(userland_open, unsigned int, flags)
> +{
> + struct userland *c;
> + int fd;
> +
> + if (flags & ~USERLAND_ALL_FLAGS)
> + return -EINVAL;
> + if (unlikely(!current->nsproxy))
> + return -EOPNOTSUPP;

This isn't a bug, but can current->nsproxy actually be NULL in a syscall
here?

A task only loses its nsproxy in exit_task_namespaces() from do_exit(),
after which it never returns to user mode. unshare() and setns() dereference
current->nsproxy without such a test, and userland_create() itself passes
current to create_new_namespaces(), which dereferences tsk->nsproxy
unconditionally.

Could this check (and its -EOPNOTSUPP return) be dropped to match
unshare()/setns()?

[ ... ]


---
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/44972669664