mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [QUESTION vfs] Namespaces from kernel code for user mode threads
Date: Mon, 5 May 2025 15:21:23 +0200	[thread overview]
Message-ID: <20250505-festplatten-befragen-0cb139d40b6d@brauner> (raw)
In-Reply-To: <20250430144436-d3c2c91d-b32e-4967-96c9-3913579ce626@linutronix.de>

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?

      reply	other threads:[~2025-05-05 13:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 13:05 Thomas Weißschuh
2025-05-05 13:21 ` Christian Brauner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250505-festplatten-befragen-0cb139d40b6d@brauner \
    --to=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®