linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] fs: harden anon inodes
@ 2025-04-07  9:54 Christian Brauner
  2025-04-07  9:54 ` [PATCH 1/9] anon_inode: use a proper mode internally Christian Brauner
                   ` (10 more replies)
  0 siblings, 11 replies; 31+ messages in thread
From: Christian Brauner @ 2025-04-07  9:54 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Christoph Hellwig, Mateusz Guzik, Penglei Jiang, Al Viro,
	Jan Kara, Jeff Layton, Josef Bacik, syzbot+5d8e79d323a13aa0b248,
	Christian Brauner, stable

* Anonymous inodes currently don't come with a proper mode causing
  issues in the kernel when we want to add useful VFS debug assert. Fix
  that by giving them a proper mode and masking it off when we report it
  to userspace which relies on them not having any mode.

* Anonymous inodes currently allow to change inode attributes because
  the VFS falls back to simple_setattr() if i_op->setattr isn't
  implemented. This means the ownership and mode for every single user
  of anon_inode_inode can be changed. Block that as it's either useless
  or actively harmful. If specific ownership is needed the respective
  subsystem should allocate anonymous inodes from their own private
  superblock.

* Port pidfs to the new anon_inode_{g,s}etattr() helpers.

* Add proper tests for anonymous inode behavior.

The anonymous inode specific fixes should ideally be backported to all
LTS kernels.

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
Christian Brauner (9):
      anon_inode: use a proper mode internally
      pidfs: use anon_inode_getattr()
      anon_inode: explicitly block ->setattr()
      pidfs: use anon_inode_setattr()
      anon_inode: raise SB_I_NODEV and SB_I_NOEXEC
      selftests/filesystems: add first test for anonymous inodes
      selftests/filesystems: add second test for anonymous inodes
      selftests/filesystems: add third test for anonymous inodes
      selftests/filesystems: add fourth test for anonymous inodes

 fs/anon_inodes.c                                   | 45 ++++++++++++++
 fs/internal.h                                      |  5 ++
 fs/libfs.c                                         |  2 +-
 fs/pidfs.c                                         | 26 +-------
 tools/testing/selftests/filesystems/.gitignore     |  1 +
 tools/testing/selftests/filesystems/Makefile       |  2 +-
 .../selftests/filesystems/anon_inode_test.c        | 69 ++++++++++++++++++++++
 7 files changed, 124 insertions(+), 26 deletions(-)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250407-work-anon_inode-e22bb1a74992


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

end of thread, other threads:[~2025-04-21  8:35 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07  9:54 [PATCH 0/9] fs: harden anon inodes Christian Brauner
2025-04-07  9:54 ` [PATCH 1/9] anon_inode: use a proper mode internally Christian Brauner
2025-04-07 12:19   ` Jeff Layton
2025-04-07 13:43     ` Christian Brauner
2025-04-07 14:04   ` Jan Kara
2025-04-11 10:31   ` Mark Brown
2025-04-11 15:03     ` Christian Brauner
2025-04-14  5:50       ` Christoph Hellwig
2025-04-18  2:15   ` Xilin Wu
2025-04-20 10:54     ` Christian Brauner
2025-04-21  8:35       ` Christian Brauner
2025-04-07  9:54 ` [PATCH 2/9] pidfs: use anon_inode_getattr() Christian Brauner
2025-04-07 14:04   ` Jan Kara
2025-04-07  9:54 ` [PATCH 3/9] anon_inode: explicitly block ->setattr() Christian Brauner
2025-04-07 14:05   ` Jan Kara
2025-04-07  9:54 ` [PATCH 4/9] pidfs: use anon_inode_setattr() Christian Brauner
2025-04-07 14:06   ` Jan Kara
2025-04-07  9:54 ` [PATCH 5/9] anon_inode: raise SB_I_NODEV and SB_I_NOEXEC Christian Brauner
2025-04-07 14:07   ` Jan Kara
2025-04-07 14:18     ` Christian Brauner
2025-04-07  9:54 ` [PATCH 6/9] selftests/filesystems: add first test for anonymous inodes Christian Brauner
2025-04-07 14:09   ` Jan Kara
2025-04-07  9:54 ` [PATCH 7/9] selftests/filesystems: add second " Christian Brauner
2025-04-07 14:09   ` Jan Kara
2025-04-07  9:54 ` [PATCH 8/9] selftests/filesystems: add third " Christian Brauner
2025-04-07 14:09   ` Jan Kara
2025-04-07  9:54 ` [PATCH 9/9] selftests/filesystems: add fourth " Christian Brauner
2025-04-07 14:09   ` Jan Kara
2025-04-07 10:19 ` [PATCH 0/9] fs: harden anon inodes Mateusz Guzik
2025-04-07 13:41   ` Christian Brauner
2025-04-07 12:37 ` Jeff Layton

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).