* [QUESTION vfs] Namespaces from kernel code for user mode threads
@ 2025-04-30 13:05 Thomas Weißschuh
2025-05-05 13:21 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2025-04-30 13:05 UTC (permalink / raw)
To: Christian Brauner, Alexander Viro; +Cc: Jan Kara, linux-fsdevel, linux-kernel
Hi everybody,
I am trying to set up mount namespaces on top of a 'struct vfsmount'
and run user mode threads inside that namespace. All of this from kernel code.
However there doesn't seem a way to run the equivalent of unshare(CLONE_NEWNS)
inside the kernel.
Is this something that should work and if so, how?
The goal is that these processes execute inside a nearly empty filesystem tree.
The full context is in this series:
https://lore.kernel.org/all/20250217-kunit-kselftests-v1-0-42b4524c3b0a@linutronix.de/
Specifically "[PATCH 09/12] kunit: Introduce UAPI testing framework"
in kunit_uapi_mount_tmpfs() and related.
Thanks,
Thomas
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [QUESTION vfs] Namespaces from kernel code for user mode threads
2025-04-30 13:05 [QUESTION vfs] Namespaces from kernel code for user mode threads Thomas Weißschuh
@ 2025-05-05 13:21 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2025-05-05 13:21 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Alexander Viro, Jan Kara, linux-fsdevel, linux-kernel
On Wed, Apr 30, 2025 at 03:05:04PM +0200, Thomas Weißschuh wrote:
> Hi everybody,
>
> I am trying to set up mount namespaces on top of a 'struct vfsmount'
> and run user mode threads inside that namespace. All of this from kernel code.
I have a hard time understanding what you want to do.
> However there doesn't seem a way to run the equivalent of unshare(CLONE_NEWNS)
> inside the kernel.
ksys_unshare(CLONE_NEWNS)?
> Is this something that should work and if so, how?
> The goal is that these processes execute inside a nearly empty filesystem tree.
>
> The full context is in this series:
> https://lore.kernel.org/all/20250217-kunit-kselftests-v1-0-42b4524c3b0a@linutronix.de/
> Specifically "[PATCH 09/12] kunit: Introduce UAPI testing framework"
> in kunit_uapi_mount_tmpfs() and related.
Shouldn't something like:
static int umh_kunit_uapi_mount_setup(struct subprocess_info *info, struct cred *new)
{
return ksys_unshare(CLONE_NEWNS);
}
sub_info = call_usermodehelper_setup(something_prog,
something_argv,
NULL,
GFP_KERNEL,
umh_kunit_uapi_mount_set(),
NULL,
something_setup_data);
retval = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC);
do what you want?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-05 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-30 13:05 [QUESTION vfs] Namespaces from kernel code for user mode threads Thomas Weißschuh
2025-05-05 13:21 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®