Re: [PATCH] Add support for empty path in openat and openat2 syscalls
From: Christian Brauner
Date: Tue Feb 24 2026 - 05:11:26 EST
On Mon, Feb 23, 2026 at 10:28:24AM -0500, Jeff Layton wrote:
> On Mon, 2026-02-23 at 16:16 +0100, Jori Koolstra wrote:
> > To get an operable version of an O_PATH file descriptors, it is possible
> > to use openat(fd, ".", O_DIRECTORY) for directories, but other files
> > currently require going through open("/proc/<pid>/fd/<nr>") which
> > depends on a functioning procfs.
> >
> > This patch adds the O_EMPTY_PATH flag to openat and openat2. If passed
> > LOOKUP_EMPTY is set at path resolve time.
> >
>
> This sounds valuable, but there was recent discussion around the
> O_REGULAR flag that said that we shouldn't be adding new flags to older
> syscalls [1]. Should this only be an OPENAT2_* flag instead?
>
> [1]: https://lore.kernel.org/linux-fsdevel/20260129-siebzehn-adler-efe74ff8f1a9@brauner/
I do like restricting it to openat2() as well.