mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christian Brauner <brauner@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [GIT PULL 08/16 for v7.2] vfs openat2
Date: Fri, 12 Jun 2026 17:13:40 +0200	[thread overview]
Message-ID: <20260612-vfs-openat2-v72-268139f61842@brauner> (raw)
In-Reply-To: <20260612-vfs-v72-20facee87e19@brauner>

Hey Linus,

/* Summary */

This contains the openat2 changes for this cycle:

Features

- Add O_EMPTYPATH to openat(2)/openat2(2). To get an operable file
  descriptor from an O_PATH file descriptor it is possible to use
  openat(fd, ".", O_DIRECTORY) for directories, but other file types
  require going through open("/proc/<pid>/fd/<nr>") and thus depend on
  a functioning procfs. With O_EMPTYPATH an empty path string is
  accepted and LOOKUP_EMPTY is set at path resolution time, allowing
  to reopen the file behind the file descriptor directly. Selftests
  are included.

- Add an OPENAT2_REGULAR flag for openat2(2) which refuses to open
  anything but regular files with the new EFTYPE error code. This
  implements the "ability to only open regular files" feature
  requested by userspace via uapi-group.org and protects services
  from being redirected to fifos, device nodes, and friends.

  All atomic_open implementations were audited for OPENAT2_REGULAR
  handling. Explicit checks were added to ceph, gfs2, nfs (v4), and
  cifs/smb - these are the filesystems whose atomic_open can encounter
  an existing non-regular file and would otherwise call finish_open()
  on it or return a misleading error code. The remaining
  implementations (9p, fuse, vboxsf, nfs v2/v3) only call
  finish_open() on freshly created files and use finish_no_open() for
  lookup hits, letting the VFS catch non-regular files via the
  do_open() safety net.

Cleanups

- Migrate the openat2 selftests to the kselftest harness and move
  them under selftests/filesystems/. The tests were written in the
  early days of selftests' TAP support and the modern kselftest
  harness is much easier to follow and maintain. The contents of the
  tests are unchanged and the new emptypath tests are ported on top.

- Make the LAST_XXX last-type constants private to fs/namei.c. The
  only user outside of fs/namei.c was ksmbd which only needs to know
  whether the last component is a regular one, so
  vfs_path_parent_lookup() now performs the LAST_NORM check
  internally. The ints are replaced with a dedicated enum last_type.

/* Testing */

gcc (Debian 14.2.0-19) 14.2.0
Debian clang version 19.1.7 (3+b1)

No build failures or warnings were observed.

/* Conflicts */

Merge conflicts with mainline
=============================

No known conflicts.

Merge conflicts with other trees
================================

The following changes since commit 254f49634ee16a731174d2ae34bc50bd5f45e731:

  Linux 7.1-rc1 (2026-04-26 14:19:00 -0700)

are available in the Git repository at:

  git@gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-7.2-rc1.openat2

for you to fetch changes up to 318643721de396012da102723f337f35ba7ec1e9:

  vfs: replace ints with enum last_type for LAST_XXX (2026-05-29 09:47:02 +0200)

----------------------------------------------------------------
vfs-7.2-rc1.openat2

Please consider pulling these changes from the signed vfs-7.2-rc1.openat2 tag.

Thanks!
Christian

----------------------------------------------------------------
Aleksa Sarai (4):
      selftests: move openat2 tests to selftests/filesystems/
      selftests: openat2: move helpers to header
      selftests: openat2: switch from custom ARRAY_LEN to ARRAY_SIZE
      selftests: openat2: migrate to kselftest harness

Christian Brauner (4):
      Merge patch series "selftests: openat2: migrate to kselftest harness"
      Merge patch series "vfs: add O_EMPTYPATH to openat(2)/openat2(2)"
      Merge patch series "OPENAT2_REGULAR flag support for openat2"
      selftests: openat2: port emptypath_test to kselftest harness

Dorjoy Chowdhury (3):
      openat2: introduce EFTYPE error code
      openat2: new OPENAT2_REGULAR flag support
      kselftest/openat2: test for OPENAT2_REGULAR flag

Jori Koolstra (4):
      vfs: add O_EMPTYPATH to openat(2)/openat2(2)
      selftest: add tests for O_EMPTYPATH
      vfs: make LAST_XXX private to fs/namei.c
      vfs: replace ints with enum last_type for LAST_XXX

 arch/alpha/include/uapi/asm/errno.h                |   2 +
 arch/mips/include/uapi/asm/errno.h                 |   2 +
 arch/parisc/include/uapi/asm/errno.h               |   2 +
 arch/sparc/include/uapi/asm/errno.h                |   2 +
 fs/ceph/file.c                                     |   4 +
 fs/fcntl.c                                         |   4 +-
 fs/gfs2/inode.c                                    |   7 +
 fs/namei.c                                         |  48 ++-
 fs/nfs/dir.c                                       |   4 +
 fs/open.c                                          |  41 ++-
 fs/smb/client/dir.c                                |  18 +-
 fs/smb/server/vfs.c                                |  15 +-
 include/linux/fcntl.h                              |  20 +-
 include/linux/namei.h                              |   7 +-
 include/uapi/asm-generic/errno.h                   |   2 +
 include/uapi/asm-generic/fcntl.h                   |   4 +
 include/uapi/linux/openat2.h                       |   7 +
 tools/arch/alpha/include/uapi/asm/errno.h          |   2 +
 tools/arch/mips/include/uapi/asm/errno.h           |   2 +
 tools/arch/parisc/include/uapi/asm/errno.h         |   2 +
 tools/arch/sparc/include/uapi/asm/errno.h          |   2 +
 tools/include/uapi/asm-generic/errno.h             |   2 +
 tools/include/uapi/linux/openat2.h                 |  43 +++
 .../selftests/{ => filesystems}/openat2/.gitignore |   0
 .../selftests/{ => filesystems}/openat2/Makefile   |   9 +-
 .../selftests/filesystems/openat2/emptypath_test.c |  77 +++++
 .../selftests/filesystems/openat2/helpers.h        | 135 ++++++++
 .../{ => filesystems}/openat2/openat2_test.c       | 262 ++++++++-------
 .../filesystems/openat2/rename_attack_test.c       | 159 +++++++++
 .../{ => filesystems}/openat2/resolve_test.c       | 368 ++++++++++++---------
 tools/testing/selftests/openat2/helpers.c          | 109 ------
 tools/testing/selftests/openat2/helpers.h          | 108 ------
 .../testing/selftests/openat2/rename_attack_test.c | 160 ---------
 33 files changed, 920 insertions(+), 709 deletions(-)
 create mode 100644 tools/include/uapi/linux/openat2.h
 rename tools/testing/selftests/{ => filesystems}/openat2/.gitignore (100%)
 rename tools/testing/selftests/{ => filesystems}/openat2/Makefile (65%)
 create mode 100644 tools/testing/selftests/filesystems/openat2/emptypath_test.c
 create mode 100644 tools/testing/selftests/filesystems/openat2/helpers.h
 rename tools/testing/selftests/{ => filesystems}/openat2/openat2_test.c (63%)
 create mode 100644 tools/testing/selftests/filesystems/openat2/rename_attack_test.c
 rename tools/testing/selftests/{ => filesystems}/openat2/resolve_test.c (74%)
 delete mode 100644 tools/testing/selftests/openat2/helpers.c
 delete mode 100644 tools/testing/selftests/openat2/helpers.h
 delete mode 100644 tools/testing/selftests/openat2/rename_attack_test.c

  parent reply	other threads:[~2026-06-12 15:13 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 15:10 [GIT PULL 00/16 for v7.2] v7.2 Christian Brauner
2026-06-12 15:11 ` [GIT PULL 01/16 for v7.2] vfs kfunc Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:11 ` [GIT PULL 02/16 for v7.2] vfs exportfs Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:12 ` [GIT PULL 03/16 for v7.2] vfs inode Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:12 ` [GIT PULL 04/16 for v7.2] vfs directory delegations Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:12 ` [GIT PULL 05/16 for v7.2] vfs casefold Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:13 ` [GIT PULL 06/16 for v7.2] kernel task_exec_state Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:13 ` [GIT PULL 07/16 for v7.2] kernel misc Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:13 ` Christian Brauner [this message]
2026-06-15  3:45   ` [GIT PULL 08/16 for v7.2] vfs openat2 pr-tracker-bot
2026-06-12 15:14 ` [GIT PULL 09/16 for v7.2] vfs super Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:14 ` [GIT PULL 10/16 for v7.2] vfs writeback Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:14 ` [GIT PULL 11/16 for v7.2] vfs bh Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:15 ` [GIT PULL 12/16 for v7.2] vfs eventpoll Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:15 ` [GIT PULL 13/16 for v7.2] vfs iomap Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:15 ` [GIT PULL 14/16 for v7.2] vfs xattr Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:16 ` [GIT PULL 15/16 for v7.2] vfs misc Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot
2026-06-12 15:16 ` [GIT PULL 16/16 for v7.2] vfs procfs Christian Brauner
2026-06-15  3:45   ` pr-tracker-bot

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=20260612-vfs-openat2-v72-268139f61842@brauner \
    --to=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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®