This is a note to let you know that I've just added the patch titled ceph: update the time stamps and try to drop the suid/sgid to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ceph-update-the-time-stamps-and-try-to-drop-the-suid-sgid.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e027253c4b77d395798600a90b6a96fe4adf4d5e Mon Sep 17 00:00:00 2001 From: Xiubo Li <xiubli@xxxxxxxxxx> Date: Mon, 13 Feb 2023 13:56:20 +0800 Subject: ceph: update the time stamps and try to drop the suid/sgid From: Xiubo Li <xiubli@xxxxxxxxxx> commit e027253c4b77d395798600a90b6a96fe4adf4d5e upstream. The fallocate will try to clear the suid/sgid if a unprevileged user changed the file. There is no POSIX item requires that we should clear the suid/sgid in fallocate code path but this is the default behaviour for most of the filesystems and the VFS layer. And also the same for the write code path, which have already support it. And also we need to update the time stamps since the fallocate will change the file contents. Cc: stable@xxxxxxxxxxxxxxx Link: https://tracker.ceph.com/issues/58054 Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx> Signed-off-by: Ilya Dryomov <idryomov@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ceph/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -2084,6 +2084,9 @@ static long ceph_fallocate(struct file * loff_t endoff = 0; loff_t size; + dout("%s %p %llx.%llx mode %x, offset %llu length %llu\n", __func__, + inode, ceph_vinop(inode), mode, offset, length); + if (mode != (FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; @@ -2124,6 +2127,10 @@ static long ceph_fallocate(struct file * if (ret < 0) goto unlock; + ret = file_modified(file); + if (ret) + goto put_caps; + filemap_invalidate_lock(inode->i_mapping); ceph_zero_pagecache_range(inode, offset, length); ret = ceph_zero_objects(inode, offset, length); @@ -2139,6 +2146,7 @@ static long ceph_fallocate(struct file * } filemap_invalidate_unlock(inode->i_mapping); +put_caps: ceph_put_cap_refs(ci, got); unlock: inode_unlock(inode); Patches currently in stable-queue which might be from xiubli@xxxxxxxxxx are queue-5.15/ceph-update-the-time-stamps-and-try-to-drop-the-suid-sgid.patch