lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241115-vfs-file-f2297d7c58ee@brauner>
Date: Fri, 15 Nov 2024 15:02:02 +0100
From: Christian Brauner <brauner@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christian Brauner <brauner@...nel.org>,
	linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [GIT PULL] vfs file

Hey Linus,

/* Summary */

This contains changes the changes for files for this cycle:

- Introduce a new reference counting mechanism for files.

  As atomic_inc_not_zero() is implemented with a try_cmpxchg() loop it
  has O(N^2) behaviour under contention with N concurrent operations and
  it is in a hot path in __fget_files_rcu().

  The rcuref infrastructures remedies this problem by using an
  unconditional increment relying on safe- and dead zones to make this
  work and requiring rcu protection for the data structure in question.
  This not just scales better it also introduces overflow protection.

  However, in contrast to generic rcuref, files require a memory barrier
  and thus cannot rely on *_relaxed() atomic operations and also require
  to be built on atomic_long_t as having massive amounts of reference
  isn't unheard of even if it is just an attack.

  This adds a file specific variant instead of making this a generic
  library.

  This has been tested by various people and it gives consistent
  improvement up to 3-5% on workloads with loads of threads.

- Add a fastpath for find_next_zero_bit(). Skip 2-levels searching via
  find_next_zero_bit() when there is a free slot in the word that contains
  the next fd. This improves pts/blogbench-1.1.0 read by 8% and write by
  4% on Intel ICX 160.

- Conditionally clear full_fds_bits since it's very likely that a bit
  in full_fds_bits has been cleared during __clear_open_fds(). This
  improves pts/blogbench-1.1.0 read up to 13%, and write up to 5% on
  Intel ICX 160.

- Get rid of all lookup_*_fdget_rcu() variants. They were used to lookup
  files without taking a reference count. That became invalid once files
  were switched to SLAB_TYPESAFE_BY_RCU and now we're always taking a
  reference count. Switch to an already existing helper and remove the
  legacy variants.

- Remove pointless includes of <linux/fdtable.h>.

- Avoid cmpxchg() in close_files() as nobody else has a reference to the
  files_struct at that point.

- Move close_range() into fs/file.c and fold __close_range() into it.

- Cleanup calling conventions of alloc_fdtable() and expand_files().

- Merge __{set,clear}_close_on_exec() into one.

- Make __set_open_fd() set cloexec as well instead of doing it
  in two separate steps.

/* Testing */

gcc version 14.2.0 (Debian 14.2.0-6)
Debian clang version 16.0.6 (27+b1)

All patches are based on v6.12-rc2 and have been sitting in linux-next.
No build failures or warnings were observed.

/* Conflicts */

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

No known conflicts.

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

No known conflicts.

The following changes since commit 8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b:

  Linux 6.12-rc2 (2024-10-06 15:32:27 -0700)

are available in the Git repository at:

  git@...olite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.13.file

for you to fetch changes up to aab154a442f9ba2a08fc130dbc8d178a33e10345:

  selftests: add file SLAB_TYPESAFE_BY_RCU recycling stressor (2024-10-30 09:58:02 +0100)

Please consider pulling these changes from the signed vfs-6.13.file tag.

Thanks!
Christian

----------------------------------------------------------------
vfs-6.13.file

----------------------------------------------------------------
Al Viro (8):
      get rid of ...lookup...fdget_rcu() family
      remove pointless includes of <linux/fdtable.h>
      close_files(): don't bother with xchg()
      move close_range(2) into fs/file.c, fold __close_range() into it
      alloc_fdtable(): change calling conventions.
      file.c: merge __{set,clear}_close_on_exec()
      make __set_open_fd() set cloexec state as well
      expand_files(): simplify calling conventions

Christian Brauner (6):
      fs: protect backing files with rcu
      fs: add file_ref
      fs: port files to file_ref
      Merge patch series "fs: introduce file_ref_t"
      Merge branch 'work.fdtable' into vfs.file
      selftests: add file SLAB_TYPESAFE_BY_RCU recycling stressor

Yu Ma (3):
      fs/file.c: remove sanity_check and add likely/unlikely in alloc_fd()
      fs/file.c: conditionally clear full_fds
      fs/file.c: add fast path in find_next_fd()

 arch/powerpc/platforms/cell/spufs/coredump.c       |   4 +-
 drivers/gpu/drm/i915/gt/shmem_utils.c              |   2 +-
 drivers/gpu/drm/vmwgfx/ttm_object.c                |   2 +-
 fs/eventpoll.c                                     |   2 +-
 fs/fcntl.c                                         |   1 -
 fs/file.c                                          | 281 +++++++++++----------
 fs/file_table.c                                    |  50 +++-
 fs/gfs2/glock.c                                    |  12 +-
 fs/notify/dnotify/dnotify.c                        |   5 +-
 fs/notify/fanotify/fanotify.c                      |   1 -
 fs/notify/fanotify/fanotify_user.c                 |   1 -
 fs/open.c                                          |  17 --
 fs/overlayfs/copy_up.c                             |   1 -
 fs/proc/base.c                                     |   1 -
 fs/proc/fd.c                                       |  12 +-
 include/linux/fdtable.h                            |   5 -
 include/linux/file.h                               |   1 +
 include/linux/file_ref.h                           | 177 +++++++++++++
 include/linux/fs.h                                 |  10 +-
 io_uring/io_uring.c                                |   1 -
 kernel/bpf/bpf_inode_storage.c                     |   1 -
 kernel/bpf/bpf_task_storage.c                      |   1 -
 kernel/bpf/task_iter.c                             |   6 +-
 kernel/bpf/token.c                                 |   1 -
 kernel/exit.c                                      |   1 -
 kernel/kcmp.c                                      |   4 +-
 kernel/module/dups.c                               |   1 -
 kernel/module/kmod.c                               |   1 -
 kernel/umh.c                                       |   1 -
 net/handshake/request.c                            |   1 -
 security/apparmor/domain.c                         |   1 -
 tools/testing/selftests/filesystems/.gitignore     |   1 +
 tools/testing/selftests/filesystems/Makefile       |   2 +-
 .../testing/selftests/filesystems/file_stressor.c  | 194 ++++++++++++++
 34 files changed, 576 insertions(+), 226 deletions(-)
 create mode 100644 include/linux/file_ref.h
 create mode 100644 tools/testing/selftests/filesystems/file_stressor.c

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ