Linux filesystem development
 help / color / mirror / Atom feed
* open_tree, and bind-mounting directories across mount namespaces
@ 2025-10-31 23:01 Snaipe
  2025-11-01 15:21 ` Franklin Snaipe Mathieu
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Snaipe @ 2025-10-31 23:01 UTC (permalink / raw)
  To: linux-fsdevel, Alexander Viro

Hi folks,

(Disclaimer: I'm not a kernel developer)

I'm currently playing around with the new mount API, on Linux 6.17.6.
One of the things I'm trying to do is to write a program that unshares
its mount namespace and receives a directory file descriptor via an
unix socket from another program that exists in a different mount
namespace. The intent is to have a program that has access to data on
a filesystem that is not normally accessible to other unprivileged
programs, and have that program give access to select directories by
opening them with O_PATH and sending the fds over a unix socket.

One snag I'm currently hitting is that once I call open_tree(fd, "",
OPEN_TREE_CLONE|AT_EMPTY_PATH|AT_RECURSIVE), the syscall returns
EINVAL; I've bpftraced it back to __do_loopback's may_copy_tree check
and it looks like it's impossible to do on dentries whose mount
namespace is different that the current task's mount namespace.

I'm trying to understand the reasons this was put in place, and what
it would take to enable the kind of use-case that I have. Would there
be a security risk to relax this condition with some kind of open_tree
flag?

Thanks,

-- 
Franklin "Snaipe" Mathieu

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-01-30 14:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 23:01 open_tree, and bind-mounting directories across mount namespaces Snaipe
2025-11-01 15:21 ` Franklin Snaipe Mathieu
2025-11-01 15:21 ` [PATCH 1/1] fs: let open_tree open mounts from another namespace Franklin Snaipe Mathieu
2025-11-05 12:05 ` open_tree, and bind-mounting directories across mount namespaces Christian Brauner
2025-11-06 12:59   ` Snaipe
2026-01-29 13:39     ` Snaipe
2026-01-29 14:54       ` Christian Brauner
2026-01-29 19:14         ` Snaipe
2026-01-30 14:55           ` Snaipe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox