linux-kernel.vger.kernel.org archive mirror
 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] vfs fixes
Date: Fri, 24 Nov 2023 11:27:28 +0100	[thread overview]
Message-ID: <20231124-vfs-fixes-3420a81c0abe@brauner> (raw)

Hey Linus,

/* Summary */
This contains the usual miscellaneous fixes:

* Avoid calling back into LSMs from vfs_getattr_nosec() calls.

  IMA used to query inode properties accessing raw inode fields without
  dedicated helpers. That was finally fixed a few releases ago by
  forcing IMA to use vfs_getattr_nosec() helpers.

  The goal of the vfs_getattr_nosec() helper is to query for attributes
  without calling into the LSM layer which would be quite problematic
  because incredibly IMA is called from __fput()...

  __fput()
    -> ima_file_free()

  What it does is to call back into the filesystem to update the file's
  IMA xattr. Querying the inode without using vfs_getattr_nosec() meant
  that IMA didn't handle stacking filesystems such as overlayfs
  correctly. So the switch to vfs_getattr_nosec() is quite correct. But
  the switch to vfs_getattr_nosec() revealed another bug when used on
  stacking filesystems:

  __fput()
    -> ima_file_free()
       -> vfs_getattr_nosec()
          -> i_op->getattr::ovl_getattr()
             -> vfs_getattr()
                -> i_op->getattr::$WHATEVER_UNDERLYING_FS_getattr()
                   -> security_inode_getattr() # calls back into LSMs

  Now, if that __fput() happens from task_work_run() of an exiting task
  current->fs and various other pointer could already be NULL. So
  anything in the LSM layer relying on that not being NULL would be
  quite surprised.

  Fix that by passing the information that this is a security request
  through to the stacking filesystem by adding a new internal
  ATT_GETATTR_NOSEC flag. Now the callchain becomes:

  __fput()
    -> ima_file_free()
       -> vfs_getattr_nosec()
          -> i_op->getattr::ovl_getattr()
             -> if (AT_GETATTR_NOSEC)
                       vfs_getattr_nosec()
                else
                       vfs_getattr()
                -> i_op->getattr::$WHATEVER_UNDERLYING_FS_getattr()

* Fix a bug introduced with the iov_iter rework from last cycle.

  This broke /proc/kcore by copying too much and without the correct
  offset.

* Add a missing NULL check when allocating the root inode in
  autofs_fill_super().

* Fix stable writes for multi-device filesystems (xfs, btrfs etc) and
  the block device pseudo filesystem.

  Stable writes used to be a superblock flag only, making it a per
  filesystem property. Add an additional AS_STABLE_WRITES mapping flag
  to allow for fine-grained control.

* Ensure that offset_iterate_dir() returns 0 after reaching the end of a
  directory so it adheres to getdents() convention.

/* Testing */
clang: Debian clang version 16.0.6 (16)
gcc: gcc (Debian 13.2.0-5) 13.2.0

All patches are based on v6.7-rc1 and have been sitting in linux-next.
No build failures or warnings were observed. Passes xfstests.

/* Conflicts */
At the time of creating this PR no merge conflicts were reported from
linux-next and no merge conflicts showed up doing a test-merge with
current mainline.

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

  Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

are available in the Git repository at:

  git@gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.7-rc3.fixes

for you to fetch changes up to 796432efab1e372d404e7a71cc6891a53f105051:

  libfs: getdents() should return 0 after reaching EOD (2023-11-20 15:34:22 +0100)

Please consider pulling these changes from the signed vfs-6.7-rc3.fixes tag.

Thanks!
Christian

----------------------------------------------------------------
vfs-6.7-rc3.fixes

----------------------------------------------------------------
Christoph Hellwig (4):
      filemap: add a per-mapping stable writes flag
      block: update the stable_writes flag in bdev_add
      xfs: clean up FS_XFLAG_REALTIME handling in xfs_ioctl_setattr_xflags
      xfs: respect the stable writes flag on the RT device

Chuck Lever (1):
      libfs: getdents() should return 0 after reaching EOD

Ian Kent (1):
      autofs: add: new_inode check in autofs_fill_super()

Omar Sandoval (1):
      iov_iter: fix copy_page_to_iter_nofault()

Stefan Berger (1):
      fs: Pass AT_GETATTR_NOSEC flag to getattr interface function

 block/bdev.c               |  2 ++
 fs/autofs/inode.c          | 56 +++++++++++++++++-----------------------------
 fs/ecryptfs/inode.c        | 12 ++++++++--
 fs/inode.c                 |  2 ++
 fs/libfs.c                 | 14 +++++++++---
 fs/overlayfs/inode.c       | 10 ++++-----
 fs/overlayfs/overlayfs.h   |  8 +++++++
 fs/stat.c                  |  6 ++++-
 fs/xfs/xfs_inode.h         |  8 +++++++
 fs/xfs/xfs_ioctl.c         | 30 ++++++++++++++++---------
 fs/xfs/xfs_iops.c          |  7 ++++++
 include/linux/pagemap.h    | 17 ++++++++++++++
 include/uapi/linux/fcntl.h |  3 +++
 lib/iov_iter.c             |  2 +-
 mm/page-writeback.c        |  2 +-
 15 files changed, 121 insertions(+), 58 deletions(-)

             reply	other threads:[~2023-11-24 10:28 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 10:27 Christian Brauner [this message]
2023-11-24 18:25 ` [GIT PULL] vfs fixes Linus Torvalds
2023-11-24 18:52   ` Linus Torvalds
2023-11-24 20:12     ` Linus Torvalds
2023-11-25 13:05       ` Christian Brauner
2023-11-25 13:10   ` Christian Brauner
2023-11-25 13:28     ` Omar Sandoval
2023-11-25 14:04       ` Christian Brauner
2023-11-24 18:26 ` pr-tracker-bot
  -- strict thread matches above, loose matches on Subject: below --
2024-04-26 14:59 Christian Brauner
2024-04-26 18:09 ` pr-tracker-bot
2024-04-05 11:22 Christian Brauner
2024-04-05 17:09 ` pr-tracker-bot
2024-03-18 12:19 Christian Brauner
2024-03-18 16:48 ` pr-tracker-bot
2024-03-18 19:14 ` Linus Torvalds
2024-03-18 19:41   ` Linus Torvalds
2024-03-19  6:58     ` Christian Brauner
2024-03-20 10:21       ` Christian Brauner
2024-03-06 15:45 Christian Brauner
2024-03-06 16:33 ` pr-tracker-bot
2024-03-01 12:45 Christian Brauner
2024-03-01 20:37 ` pr-tracker-bot
2024-02-22 14:03 Christian Brauner
2024-02-22 18:18 ` pr-tracker-bot
2024-02-12 13:00 Christian Brauner
2024-02-12 17:03 ` pr-tracker-bot
2024-01-13 12:31 Christian Brauner
2024-01-17 20:03 ` pr-tracker-bot
2023-10-19 10:07 Christian Brauner
2023-10-19 16:37 ` Linus Torvalds
2023-10-20 11:14   ` Christian Brauner
2023-10-19 18:36 ` pr-tracker-bot
2023-09-26 10:39 Christian Brauner
2023-09-26 16:14 ` pr-tracker-bot
2023-07-06 11:52 Christian Brauner
2023-07-07  2:27 ` pr-tracker-bot
2023-07-02 11:28 Christian Brauner
2023-07-02 18:53 ` pr-tracker-bot
2023-05-25 12:22 Christian Brauner
2023-05-25 18:18 ` pr-tracker-bot
2023-05-12 15:31 Christian Brauner
2023-05-12 22:14 ` pr-tracker-bot
2023-04-03 11:04 Christian Brauner
2023-04-03 16:51 ` pr-tracker-bot
2023-03-12 12:18 Christian Brauner
2023-03-12 16:20 ` pr-tracker-bot
2020-09-22 21:29 [git pull] " Al Viro
2020-09-22 22:15 ` pr-tracker-bot
     [not found] <CAHk-=wgdsv1UA+QtgiJM8KQAG7N7_9iK_edchnzZYyj+nxmfLA@mail.gmail.com>
     [not found] ` <20200113195448.GT8904@ZenIV.linux.org.uk>
     [not found]   ` <CAHk-=whn5qk-e-KnYr6HNe5hp45v+XyDbsA2+szXvK3gC06A2w@mail.gmail.com>
2020-01-15  6:41     ` Al Viro
2020-01-15 19:35       ` pr-tracker-bot
2018-04-20 15:58 Al Viro
2018-04-20 18:29 ` Andrew Morton
2018-04-20 19:09   ` Al Viro
2018-04-20 19:57     ` Andrew Morton
2017-06-17  2:56 Al Viro
2017-04-09  5:40 Al Viro
2017-04-11  6:10 ` Linus Torvalds
2017-04-11  6:48   ` Al Viro
2017-04-11 21:02     ` Andreas Dilger
2017-04-12  7:00       ` Linus Torvalds
2017-04-15  6:41 ` Vegard Nossum
2017-04-15 16:51   ` Linus Torvalds
2017-04-15 17:08     ` Al Viro
2017-04-02 17:01 Al Viro
2017-04-02 23:59 ` Linus Torvalds
2017-04-03  0:10   ` Linus Torvalds
2017-04-03  0:30     ` Al Viro
2017-04-03  0:43       ` Al Viro
2017-04-03  0:58         ` Linus Torvalds
2017-04-03  2:21           ` Al Viro
2017-04-03  6:00             ` Eric W. Biederman
2017-04-03  7:46               ` Al Viro
2017-04-04  0:22               ` Ian Kent
2017-04-04  0:47               ` Ian Kent
2017-04-03  0:20   ` Al Viro
     [not found] <13136.1466196630@jrobl>
     [not found] ` <20160617221614.GE14480@ZenIV.linux.org.uk>
     [not found]   ` <2123.1466313884@jrobl>
     [not found]     ` <20160619165557.GH14480@ZenIV.linux.org.uk>
     [not found]       ` <28627.1466397254@jrobl>
     [not found]         ` <20160620053530.GI14480@ZenIV.linux.org.uk>
     [not found]           ` <20160620145125.GL14480@ZenIV.linux.org.uk>
2016-06-20 17:14             ` Al Viro
2016-06-08  2:12 Al Viro
2016-05-28  0:10 Al Viro
2016-02-28  1:09 Al Viro
2014-09-14 19:47 Al Viro
2014-09-26 20:38 ` Joachim Eastwood
2014-09-26 20:46 ` Joachim Eastwood
2014-09-26 20:58   ` Al Viro
2014-09-26 21:28     ` Joachim Eastwood
2014-09-26 21:52       ` Joachim Eastwood
2014-03-24 22:58 Imre Deak
2014-03-25  7:21 ` Sedat Dilek
2014-03-23  7:16 Al Viro
2014-03-23 10:57 ` Sedat Dilek
2014-03-23 15:35   ` Al Viro
2014-03-23 16:56     ` Al Viro
2014-03-23 16:36 ` Linus Torvalds
2014-03-23 16:45   ` Al Viro
2014-03-23 17:01     ` Linus Torvalds
2014-03-24  8:52       ` Sedat Dilek
2014-03-25  0:46         ` Linus Torvalds
2014-03-26 16:36           ` Sedat Dilek
2014-03-26 20:55             ` Linus Torvalds
2014-03-27  6:14               ` Sedat Dilek
2014-03-30 20:33               ` Al Viro
2014-03-30 20:55                 ` Al Viro
2014-03-30 22:39                   ` Linus Torvalds
2014-03-30 23:21                     ` Al Viro
2013-06-22  7:16 Al Viro
2013-03-27  0:36 Al Viro
2012-03-10 21:30 Al Viro
2012-03-10 21:49 ` Linus Torvalds
2012-03-10 22:14   ` Al Viro
2010-01-29  2:39 Al Viro
2010-01-17  7:57 Al Viro
2008-08-25  5:25 Al Viro
2008-08-25  5:29 ` Al Viro

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=20231124-vfs-fixes-3420a81c0abe@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;
as well as URLs for NNTP newsgroup(s).