Re: [PATCH] vfs: transitive upgrade restrictions for fds

From: Greg KH

Date: Tue Mar 24 2026 - 10:39:32 EST


On Mon, Mar 23, 2026 at 11:00:22PM +0100, Jori Koolstra wrote:
> Add upgrade restrictions to openat2(). Extend struct open_how to allow
> setting transitive restrictions on using file descriptors to open other
> files. A use case for this feature is to block services or containers
> from re-opening/upgrading an O_PATH file descriptor through e.g.
> /proc/<pid>/fd/<nr as O_WRONLY.
>
> The idea for this features comes form the UAPI group kernel feature idea
> list [1].
>
> [1] https://github.com/uapi-group/kernel-features?tab=readme-ov-file#upgrade-masks-in-openat2
>
> Signed-off-by: Jori Koolstra <jkoolstra@xxxxxxxxx>
> ---
> fs/file_table.c | 2 ++
> fs/internal.h | 1 +
> fs/namei.c | 38 ++++++++++++++++++++++++++++----
> fs/open.c | 9 ++++++++
> fs/proc/base.c | 24 ++++++++++++++------
> fs/proc/fd.c | 6 ++++-
> fs/proc/internal.h | 4 +++-
> include/linux/fcntl.h | 6 ++++-
> include/linux/fs.h | 1 +
> include/linux/namei.h | 15 ++++++++++++-
> include/uapi/asm-generic/fcntl.h | 4 ++++
> include/uapi/linux/openat2.h | 1 +
> 12 files changed, 96 insertions(+), 15 deletions(-)

Any chance to get a test for this as well to know if this keeps working
(or works at all)?

> /*
> * Helper to directly jump to a known parsed path from ->get_link,
> * caller must have taken a reference to path beforehand.
> */
> -int nd_jump_link(const struct path *path)
> +int nd_jump_link_how(const struct path *path, const struct jump_how how)

Shouldn't that be "const struct jump_how *how"?

Or do you really want to pass this structure on the stack?

thanks,

greg k-h