Re: [RFC PATCH v10 21/28] ipc/mqueue: Implement ->set_run() fs_context operation
From: bot+bpf-ci
Date: Fri Dec 04 2026 - 23:02:39 EST
> ipc/mqueue: Implement ->set_run() fs_context operation
TL;DR: Commit message only: mqueue_init_fs_context() now skips IPC namespace
capture on reconfigure (fspick, remount) without saying so, and the new
comment is confusing. Not a bug.
> ipc/mqueue: Implement ->set_run() fs_context operation
>
> mqueue_init_fs_context() captures current->nsproxy->ipc_ns and resets
> fc->user_ns to ctx->ipc_ns->user_ns, overriding the user namespace
> delegated by FSCONFIG_SET_RUN and leaving the context bound to the
> caller's IPC namespace.
> Wire up mqueue_set_run() to switch ctx->ipc_ns to the target
> run's IPC namespace, update fc->user_ns to match, and mark mqueue
> with FS_RUN_MOUNT.
> Co-developed-by: David Howells <dhowells@xxxxxxxxxx>
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
[ ... ]
> @@ -453,9 +468,16 @@ static int mqueue_init_fs_context(struct fs_context *fc)
> if (!ctx)
> return -ENOMEM;
>
> - ctx->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns);
> - put_user_ns(fc->user_ns);
> - fc->user_ns = get_user_ns(ctx->ipc_ns->user_ns);
> + /*
> + * Reconfiguration keeps the superblock's user namespace and does not
> + * use ctx->ipc_ns, which put_ipc_ns() could be tearing down via
> + * sb->s_fs_info.
> + */
> + if (fc->purpose != FS_CONTEXT_FOR_RECONFIGURE) {
> + ctx->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns);
> + put_user_ns(fc->user_ns);
> + fc->user_ns = get_user_ns(ctx->ipc_ns->user_ns);
> + }
> fc->fs_private = ctx;
> fc->ops = &mqueue_fs_context_ops;
> return 0;
This isn't a bug, but the changelog only describes the new ->set_run()
operation and the FS_RUN_MOUNT flag. It doesn't mention that
mqueue_init_fs_context() now skips capturing the IPC namespace and
overriding fc->user_ns when fc->purpose == FS_CONTEXT_FOR_RECONFIGURE.
That change applies to every fspick() and remount of mqueue, and to the
re-initialisation done after fsmount(), not only to run-bound contexts.
For those paths ctx->ipc_ns is now NULL, and fc->user_ns stays as the
superblock's user namespace.
The new comment is also hard to follow. It says ctx->ipc_ns is something
put_ipc_ns() "could be tearing down via sb->s_fs_info", but neither the old
nor the new code reads sb->s_fs_info here.
Could the changelog say why the FS_CONTEXT_FOR_RECONFIGURE case is now
skipped, and could the comment be reworded to say that, unlike proc, mqueue
does not take the superblock's IPC namespace from sb->s_fs_info? Or would
this hunk be better as a separate patch?
---
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/47474652355