linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Safety of resolving untrusted paths with detached mount dirfd
@ 2025-11-19 13:46 Alyssa Ross
  2025-11-19 18:34 ` David Laight
  2025-11-20  2:18 ` Aleksa Sarai
  0 siblings, 2 replies; 5+ messages in thread
From: Alyssa Ross @ 2025-11-19 13:46 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Demi Marie Obenour, Aleksa Sarai, Jann Horn, Eric W. Biederman,
	jlayton, Bruce Fields, Al Viro, Arnd Bergmann, shuah,
	David Howells, Andy Lutomirski, Christian Brauner, Tycho Andersen,
	linux-kernel, linux-api

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]

Hello,

As we know, it's not safe to use chroot() for resolving untrusted paths
within some root, as a subdirectory could be moved outside of the
process root while walking the path[1].  On the other hand,
LOOKUP_BENEATH is supposed to be robust against this, and going by [2],
it sounds like resolving with the mount namespace root as dirfd should
also be.

My question is: would resolving an untrusted path against a detached
mount root dirfd opened with OPEN_TREE_CLONE (not necessarily a
filesystem root) also be expected to be robust against traversal issues?
i.e. can I rely on an untrusted path never resolving to a path that
isn't under the mount root?

[1]: https://lore.kernel.org/lkml/CAG48ez30WJhbsro2HOc_DR7V91M+hNFzBP5ogRMZaxbAORvqzg@mail.gmail.com/
[2]: https://lore.kernel.org/lkml/C89D720F-3CC4-4FA9-9CBB-E41A67360A6B@amacapital.net/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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

end of thread, other threads:[~2025-11-20  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 13:46 Safety of resolving untrusted paths with detached mount dirfd Alyssa Ross
2025-11-19 18:34 ` David Laight
2025-11-20  2:18 ` Aleksa Sarai
2025-11-20  2:39   ` Demi Marie Obenour
2025-11-20  9:24     ` Aleksa Sarai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).