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@xxxxxxxxxxxxx/ > 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?