Commit Graph

1307 Commits

Author SHA1 Message Date
Benjamin Coddington bda34249d2 filelock: move file locking definitions to separate header file
JIRA: https://issues.redhat.com/browse/RHEL-94440
Conflicts: fs/{cifs => smb/client} move already happened, so update includes
	there instead.  We don't have ksmbd, so drop those changes.  Slight context
	diff in fs/nfsd/netns.h.  Also don't have "a75d30c77207 fs/locks: pass
	kernel struct flock to fcntl_getlk/setlk" which removes __user deco.

commit 5970e15dbcfeb0ed3a0bf1954f35bbe60a048754
Author: Jeff Layton <jlayton@kernel.org>
Date:   Sun Nov 20 09:15:34 2022 -0500

    filelock: move file locking definitions to separate header file

    The file locking definitions have lived in fs.h since the dawn of time,
    but they are only used by a small subset of the source files that
    include it.

    Move the file locking definitions to a new header file, and add the
    appropriate #include directives to the source files that need them. By
    doing this we trim down fs.h a bit and limit the amount of rebuilding
    that has to be done when we make changes to the file locking APIs.

    Reviewed-by: Xiubo Li <xiubli@redhat.com>
    Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: David Howells <dhowells@redhat.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Acked-by: Chuck Lever <chuck.lever@oracle.com>
    Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Acked-by: Steve French <stfrench@microsoft.com>
    Acked-by: Al Viro <viro@zeniv.linux.org.uk>
    Acked-by: Darrick J. Wong <djwong@kernel.org>
    Signed-off-by: Jeff Layton <jlayton@kernel.org>

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
2025-07-11 07:21:33 -04:00
Rado Vrbovsky c154c6dc53 Merge: fs: backport mnt_idmap type
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4324

JIRA: https://issues.redhat.com/browse/RHEL-33888

This MR back ports idmapping changes to sync. our RHEL-9 kernel with the
upstream kernel to version 6.3.

Our current kernel has idmapped mounts support but there have been many
changes since this initial implementation in the base kernel. In
particular we need the type safety changes and we have seen difficulty
back porting other requested changes on more than one occassion.

The Jira this MR has been raised for is arother example of such a request.

It is needed for a back port of a BPF feature to RHEL 9 which allows BPF
programs to do file verification with LSM and fsverity. To satisfy this
request changes made in the upstream 6.3 kernel are needed which is the
reason we have chosen upstream 6.3 as the target release for the MR.

The first fix has been omitted because it appears to be the same as
24b5308cf5ee ("selftests/filesystems: grant executable permission to
run_fat_tests.sh"). In any case the requirement is to make the path
tools/testing/selftests/filesystems/fat/run_fat_tests.sh executable which
is done.

The second and third Omitted patches are a straight apply and revert leaving
the source unchanged.

Omitted-Fix: 1d4beeb4edc7 ("selftests/filesystems: grant executable permission to run_fat_tests.sh")

Omitted-Fix: 4a47c6385bb4 ovl: turn of SB_POSIXACL with idmapped layers temporarily

Omitted-Fix: 7c4d37c269ac Revert "ovl: turn of SB_POSIXACL with idmapped layers temporarily"

Signed-off-by: Ian Kent <ikent@redhat.com>

Approved-by: Scott Mayhew <smayhew@redhat.com>
Approved-by: Chris von Recklinghausen <crecklin@redhat.com>
Approved-by: Xin Long <lxin@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2024-11-11 08:26:30 +00:00
Ian Kent db8603ce12 fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: Dropped hunks for ksmbd because the source is not present in the
	CentOS Stream source tree.
	CentOS Stream has commit bb901646d2 ("ovl: let helper
	ovl_i_path_real() return the realinode") which wasn't present
	upstream when this patch was applied, correct manually.
	CentOS Stream does not have upstream commit c7423dbdbc9ec
	("ima: Handle -ESTALE returned by ima_filter_rule_match()")
	which results in a reject of hunk #3 against
	security/integrity/ima/ima_policy.c, so manually apply hunk.
	Upstream merge commit 05e6295f7b5e0 ("Merge tag 'fs.idmapped.v6.3'
	of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping")
	together with Upstream commit facd61053cff1 ("fuse: fixes after
	adapting to new posix acl api") results in a conflict in
	fs/fuse/acl.c, adjust to suit.
	Update the call to i_uid_into_vfsuid() from 2740f64cb7f00
	("filelocks: use mount idmapping for setlease permission check")
	to pass an idmap instead of a user namespace.
	It looks like Linus made a change to the merge request "Merge tag
	8834147f95056 ("fscache-rewrite-20220111") to account for idmap
	changes (probably the ones in this commit, so add the change here.

commit e67fe63341b8117d7e0d9acf0f1222d5138b9266
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:30 2023 +0100

    fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap

    Convert to struct mnt_idmap.
    Remove legacy file_mnt_user_ns() and mnt_user_ns().

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 11:02:01 +08:00
Ian Kent edf17476c7 fs: port privilege checking helpers to mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	Upstream merge commit 05e6295f7b5e0 ("Merge tag 'fs.idmapped.v6.3'
	of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping")
	together with Upstream commit facd61053cff1 ("fuse: fixes after
	adapting to new posix acl api") results in a conflict in
	fs/fuse/acl.c, adjust to suit.

commit 9452e93e6dae862d7aeff2b11236d79bde6f9b66
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:27 2023 +0100

    fs: port privilege checking helpers to mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:31 +08:00
Ian Kent 92d69b838d fs: port xattr to mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: The cifs source has been moved in CentOS Stream so manually
	apply rejected hunk to fs/smb/client/xattr.c.
        Dropped hunks for ntfs3 because the source is not present in
        the CentOS Stream source tree.
	CentOS Stream commit 98ba731fc7 ("ovl: Move xattr support
	to new xattrs.c file") moved ovl_own_xattr_set(), manually apply
	changes.
	CentOS Stream commit 67e2fcb2f3 ("evm: don't copy up
	'security.evm' xattr") is present causing hunk #1 against
	include/linux/evm.h to be rejected, manually apply.
	Upstream commit 5d1ef2ce13a90 ("ima: Introduce
	ima_get_current_hash_algo()") is not present in CentOS Stream
	which causes fuzz 1 for hunk #1 against include/linux/ima.h.
	There's a reject of hunk #1 for include/linux/lsm_hooks.h but
	I can't see any reason for it, manually applied the hunk.
	CentOS Stream does not have upstream commit ce5bb5a86e5eb
	("ima: Return int in the functions to measure a buffer") which
	results in a reject of hunk #2 against security/integrity/ima/ima.h
	and hunks #8 and #11 against security/integrity/ima/ima_main.c, so
	manually apply hunks. There also appears to be a whitespace
	mismatch causing hunk #7 to report fuzz 2 on application.
	CentOS Stream does not have upstream commit c7423dbdbc9ec
	("ima: Handle -ESTALE returned by ima_filter_rule_match()")
	which results in a reject of hunk #3 against
	security/integrity/ima/ima_policy.c, so manually apply hunk.

commit 39f60c1ccee72caa0104145b5dbf5d37cce1ea39
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:23 2023 +0100

    fs: port xattr to mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:21 +08:00
Ian Kent 304ec491ee fs: port ->permission() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	CentOS Stream commit 48fa94aacd ("ceph: fscrypt_auth handling
	for ceph") is presnt which causes fuzz 2 in hunk #1 in
	fs/ceph/super.h.
	Upstream commit 427505ffeaa46 ("exportfs: use pr_debug for
	unreachable debug statements") is not present causing fuzz 2
	in hunk #1 against fs/exportfs/expfs.c.
	Dropped hunks for ksmbd because the source is not present in the
	CentOS Stream source tree.
	Upstream commit 03fa86e9f79d8 ("namei: stash the sampled ->d_seq
	into nameidata") is not present causing a fuzz 1 for hunk #14
	against fs/namei.c.
	CentOS Stream c4f3dd0731 ("nfsd: handle failure to collect
	pre/post-op attrs more sanely") is present and causes a rejects
	for hunks #4 and #5 against fs/nfsd/vfs.c, apply manually.
	Dropped hunks for ntfs3 because the source is not present in the
	CentOS Stream source tree.
	CentOS Stream commit 98ba731fc7 ("ovl: Move xattr support to
	new xattrs.c file") moves ovl_xattr_set() and ovl_xattr_get()
	from fs/overlayfs/inode.c to fs/overlayfs/xattrs.c which causes
	hunks #4 and #5 to fail, manually apply to fs/overlayfs/xattrs.c.
	CentOS Stream commit 55177e4b83 ("ovl: mark xwhiteouts directory
	with overlay.opaque='x'") and commit d17b324bb6 ("ovl: use
	ovl_numlower() and ovl_lowerstack() accessors") change the first
	and third hunks of fs/overlayfs/namei.c causing them to fail,
	manually apply.
	CentOS Stream commit 98ba731fc7 ("ovl: Move xattr support to
	new xattrs.c file") causes fuzz 2 in hunk #5 of
	fs/overlayfs/overlayfs.h
	CentOS Stream commit 355a9c490a ("ovl: Add an alternative
	type of whiteout") changes ovl_cache_update_ino() to
	ovl_cache_update() in fs/overlayfs/readdir.c, make the change
	manually.
	Upstream commit 217af7e2f4deb ("apparmor: refactor profile
	rules and attachments") is not in CentOS Stream causing hunk #1
	to fail to apply so manually apply the change.

commit 4609e1f18e19c3b302e1eb4858334bca1532f780
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:22 2023 +0100

    fs: port ->permission() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:20 +08:00
Ian Kent 060dc0b240 fs: port ->fileattr_set() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.

commit 8782a9aea3ab4d697ad67d1f8ebca38a4e1c24ab
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:21 2023 +0100

    fs: port ->fileattr_set() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:18 +08:00
Ian Kent be97228574 fs: port ->set_acl() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsacl.c and
	fs/smb/client/cifsproto.h.
	Dropped hunks for ntfs3 and ksmbd because the source is not
	present in the CentOS Stream source tree.
	CentOS Stream commit 892da692fa ("shmem: support idmapped
	mounts for tmpfs") is present, which cuases hunk #1 against
	mm/shmem.c to be rejected, manually apply the hunk.
	CentOS Stream commit 48fa94aacd ("ceph: fscrypt_auth handling
	for ceph") is present which causes fuzz 1 of hunk #1 against
	fs/ceph/inode.c.

commit 13e83a4923bea7c4f2f6714030cb7e56d20ef7e5
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:20 2023 +0100

    fs: port ->set_acl() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:12 +08:00
Ian Kent 1176258599 fs: port ->get_acl() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsacl.c and
	fs/smb/client/cifsproto.h.
	Upstream merge commit 05e6295f7b5e0 ("Merge tag 'fs.idmapped.v6.3'
	of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping")
	has changes already applied in Upstream commit facd61053cff1 (
	"fuse: fixes after adapting to new posix acl api") so just apply
	the additional changes (those that relate to the ->get_act() port).
	CentOS Stream commit 98ba731fc7 ("ovl: Move xattr support
	to new xattrs.c file") resulted in fuzz for its hunk against
	fs/overlayfs/overlayfs.h.

commit 77435322777d8a8a08264a39111bef94e32b871b
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:19 2023 +0100

    fs: port ->get_acl() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:11 +08:00
Ian Kent 0dcf7b37eb fs: port ->tmpfile() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	Upstream commit 863f144f12add ("vfs: open inside ->tmpfile()") is
	not present which caused a reject in fs/f2fs/namei.c for hunk #1,
	applied manually.
	The hunk of the patch against fs/minix/namei.c was rejected but I
	can't see any reason for it, applied manually.
	CentOS Stream has commit 9e0a1fff8d ("ubifs: Implement
	RENAME_WHITEOUT") which caused a reject in the hunk against
	fs/ubifs/dir.c, manually applied.

commit 011e2b717b1b921d3706a9d48ff83a025563e826
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:18 2023 +0100

    fs: port ->tmpfile() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:10 +08:00
Ian Kent 3ad3f4ea76 fuse: implement ->tmpfile()
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: Hunk #1 on include/uapi/linux/fuse.h was rejected because
	there are some differences, we have CentOS Stream commitis
	328cc1ffc2 ("fuse: support per inode DAX in fuse protocol")
	and c4ea092a2a ("fuse: add feature flag for expire-only")
	but we don't have upstream commit 98046f7486db7 ("fuse: support
	per inode DAX in fuse protocol"). Consequently the version
	changelog will not match upstream.
	Hunk #5 against fs/fuse/dir.c failed due out of order a patch
	pplication, in the context fuse_mkdir()	already has the idmap
	parameter, hunk applied manually.

commit 7d37539037c2fca70346fbedc219f655253d5cff
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Sat Sep 24 07:00:00 2022 +0200

    fuse: implement ->tmpfile()

    This is basically equivalent to the FUSE_CREATE operation which creates and
    opens a regular file.

    Add a new FUSE_TMPFILE operation, otherwise just reuse the protocol and the
    code for FUSE_CREATE.

    Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:09 +08:00
Ian Kent 956e3ad810 fs: port ->mknod() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsfs.h and
	fs/smb/client/dir.c.
	Dropped hunks for ntfs3 because the source is not present in the
	CentOS Stream source tree.
	CentOS Stream commit 892da692fa ("shmem: support idmapped
	mounts for tmpfs") is present, which cuases hunks #2-#4 to be
	rejected, manually apply the hunks.
	CentOS Stream commit f0f830cd7e ("ceph: create symlinks with
	encrypted and base64-encoded targets") is present and resulted
	in fuzz against fs/ceph/dir.c hunk #2.
	Upstream commit 863f144f12add ("vfs: open inside ->tmpfile()")
	is missing causing fuzz against fs/ext2/namei.c.
	Upstream commit 7d37539037c2f ("fuse: implement ->tmpfile()")
	is missing causing fuzz in hunk #4 against fs/fuse/dir.c.
	CentOS Stream commit 892da692fa ("shmem: support idmapped
	mounts for tmpfs") is present, so a patch reorder was needed
	with appropriate adjustments.

commit 5ebb29bee8d5fc173b774e0755be8cb335503ee3
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:16 2023 +0100

    fs: port ->mknod() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:08 +08:00
Ian Kent 19f3b4f1ba fs: port ->rename() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsfs.h and
	fs/smb/client/inode.c.
	Dropped hunks for ntfs3 because the source is not present in the
	CentOS Stream source tree.
	Upstream commit cc14d24026704 ("hpfs: Convert symlinks to
	read_folio") is not present which causes fuzz 1 for hunk #1.
	CentOS Stream commit 892da692fa ("shmem: support idmapped
	mounts for tmpfs") is present, so a patch reorder was needed
	with appropriate adjustments.

commit e18275ae55e07a2937e48134589c2f4c1d99a369
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:17 2023 +0100

    fs: port ->rename() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:07 +08:00
Ian Kent a7750be4f4 fs: port ->mkdir() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsfs.h and
	fs/smb/client/inode.c.
	Dropped hunks for ntfs3 because the source is not present in the
	CentOS Stream source tree.

commit c54bd91e9eaba43f09aadc25b52ea869ff3b5587
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:15 2023 +0100

    fs: port ->mkdir() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:00 +08:00
Ian Kent 5744ba0ee3 fs: port ->symlink() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsfs.h and
	fs/smb/client/link.c.
	Dropped hunks for ntfs3 because the source is not present in the
	CentOS Stream source tree.
	CentOS Stream commit f0f830cd7e ("ceph: create symlinks with
	encrypted and base64-encoded targets") is present and resulted
	in fuzz against fs/ceph/dir.c.

commit 7a77db95511c39be4b2db2ceca152ef589adc2dc
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:14 2023 +0100

    fs: port ->symlink() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:45:00 +08:00
Ian Kent a56d1daadf fs: port ->create() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsfs.h and
	fs/smb/client/dir.c.
	Dropped hunks for ntfs3 because the source is not present in the
	CentOS Stream source tree.
	CentOS Stream commit 892da692fa ("shmem: support idmapped
	mounts for tmpfs") is present, which cuases fuzz in mm/shmem.c.

commit 6c960e68aaed335a0040f16654f3c5e5bfcf9249
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:13 2023 +0100

    fs: port ->create() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 10:44:53 +08:00
Ian Kent 6ad3fa5fce fs: port ->getattr() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: CentOS Stream has commit 3e0b6f1fa9 ("afs: use
	read_seqbegin() in afs_check_validity() and afs_getattr()"),
	manually apply hunk #2 to fs/afs/inode.c.
	CentOS Stream commit 3b06927229 {"afs: split
        afs_pagecache_valid() out of afs_validate()") is present which
        causes a reject in fs/afs/internal.h, manually apply hunk to
	fs/afs/internal.h.
	For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	CentOS Stream commit 48fa94aacd ("ceph: fscrypt_auth handling
	for ceph") alters the definition of _ceph_setattr() causing fuzz.
	The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsfs.h and
	fs/smb/client/inode.c.
	Upstream commit 2e1d66379e ("staging: erofs: drop the extern
        prefix for function definitions") caused strange behaviour when
        applying this patch, there was a conflict in fs/erofs/internal.h but
        after a refresh the hunk and context looked ok. The hunk had to be
	manually applied.
	Upstream commit 2db0487faa211 ("f2fs: move f2fs_force_buffered_io()
	into file.c") is not present in CentOS Stream which causes fuzz
	when applying the first hunk to fs/f2fs/file.c.
	Upstream commit 30abce053f811 ("fat: report creation time in statx")
	is not present in CentOS Stream which caused a reject so apply change
	manually.
	Dropped hunks for ksmbd because the source is not present in the
	CentOS Stream source tree.
	Dropped hunks for ntfs3 because the source is not present in the
	CentOS Stream source tree.
	There was fuzz with hunk #2 against fs/nfs/inode.c but I was
	unable to see any difference.
	CentOS Stream commit 98ba731fc7 ("ovl: Move xattr support
	to new xattrs.c file") is present which caused fuzz in
	fs/overlayfs/overlayfs.h.
	Upstream commit d919a1e79bac8 ("proc: fix a dentry lock race
	between release_task and lookup") is not present in CentOS
	Stream causing fuzz applying hunk #1 against fs/proc/base.c.
	CentOS Stream commit 20c470188c ("vfs: plumb i_version
	handling into struct kstat") is present causing fuzz in hunk
	#2 against fs/stat.c.
	Upstream commit e0c49bd2b4d3c ("fs: sysv: Fix sysv_nblocks()
	returns wrong value") is not present in CentOS Stream causing
	fuzz applying hunk#1 against fs/sysv/itree.c.
	CentOS Stream commit 892da692fa ("shmem: support idmapped
	mounts for tmpfs") is present so it's ok to pass idmap to
	generic_fillattr().
	CentOS Stream commit f0f830cd7e {"ceph: create symlinks
	with encrypted and base64-encoded targets") uses the old
	struct user_namespace and so leaves those changes out, make
	those getattr() changes here.
	Allow for CentOS Stream commit 6c3396a0d8 ("kernfs: Introduce
	separate rwsem to protect inode attributes") which is already
	present.
	CentOS Stream commit f5219db0c0 ("KVM: fix Add KVM_CREATE_GUEST_MEMFD
	ioctl() for guest-specific backing memory") updated the upstream commit
	a7800aa80ea4d ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific
	backing memory") to account for missing idmapping commits. Now we have
	updated the second and final place these changes were made make the final
	needed adjustment to match the original upstream patch.

commit b74d24f7a74ffd2d42ca883d84b7422b8d545901
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:12 2023 +0100

    fs: port ->getattr() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 09:37:45 +08:00
Ian Kent 43ca440cdf fs: port ->setattr() to pass mnt_idmap
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: CentOS Stream commit 3c29fadfb1 ("afs: split
	afs_pagecache_valid() out of afs_validate()") is present, manually
	adjust hunk #1 of fs/afs/internal.h.
	For consistency drop btrfs hunks because it isn't supported in
	CentOS Stream and other backports also drop such hunks.
	CentOS Stream commit 48fa94aacd ("ceph: fscrypt_auth handling
	for ceph") alters the definition of _ceph_setattr(), adjust
	manually.
	CentOS Stream commit 34b2a2b5a3 {"ceph: add some fscrypt
	guardrails") introduces a call to fscrypt_prepare_setattr() which
	causes fuzz when applying.
	The cifs source has been moved in CentOS Stream so manually
	apply rejected hunks to fs/smb/client/cifsfs.h and
	fs/smb/client/inode.c.
	Upstream commit 5a646fb3a3e2d ("coda: avoid doing bad things on
	inode type changes during revalidation") is not present which
	causes fuzz in fs/coda/coda_linux.h.
	Dropped hunks for ntfs3 because the source is not present in
	the CentOS Stream source tree.
	CentOS Stream commit 98ba731fc7 ("ovl: Move xattr support
	to new xattrs.c file") is presnt so manually apply hunk.
	CentOS Stream commit 892da692fa ("shmem: support idmapped
	mounts for tmpfs") is present so it's ok to pass idmap to
	setattr_prepare() and setattr_copy().
	Update to add incremental changes needed due to CentOS Stream
	commit 469e1d13f6 ("shmem: quota support").
	Allow for CentOS Stream commit 6c3396a0d8 ("kernfs: Introduce
	separate rwsem to protect inode attributes") which is already
	present.
	CentOS Stream commit f5219db0c0 ("KVM: fix Add KVM_CREATE_GUEST_MEMFD
	ioctl() for guest-specific backing memory") updated the upstream commit
	a7800aa80ea4d ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific
	backing memory") to account for missing idmapping commits. Now we have
	updated one of the two places these changes were made make one of the
	needed adjustments to match the original upstream patch.

commit c1632a0f11209338fc300c66252bcc4686e609e8
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 13 12:49:11 2023 +0100

    fs: port ->setattr() to pass mnt_idmap

    Convert to struct mnt_idmap.

    Last cycle we merged the necessary infrastructure in
    256c8aed2b42 ("fs: introduce dedicated idmap type for mounts").
    This is just the conversion to struct mnt_idmap.

    Currently we still pass around the plain namespace that was attached to a
    mount. This is in general pretty convenient but it makes it easy to
    conflate namespaces that are relevant on the filesystem with namespaces
    that are relevent on the mount level. Especially for non-vfs developers
    without detailed knowledge in this area this can be a potential source for
    bugs.

    Once the conversion to struct mnt_idmap is done all helpers down to the
    really low-level helpers will take a struct mnt_idmap argument instead of
    two namespace arguments. This way it becomes impossible to conflate the two
    eliminating the possibility of any bugs. All of the vfs and all filesystems
    only operate on struct mnt_idmap.

    Acked-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-16 09:07:05 +08:00
Ian Kent dc1f3bea48 attr: use consistent sgid stripping checks
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

commit ed5a7047d2011cb6b2bf84ceb6680124cc6a7d95
Author: Christian Brauner <brauner@kernel.org>
Date:   Mon Oct 17 17:06:37 2022 +0200

    attr: use consistent sgid stripping checks

    Currently setgid stripping in file_remove_privs()'s should_remove_suid()
    helper is inconsistent with other parts of the vfs. Specifically, it only
    raises ATTR_KILL_SGID if the inode is S_ISGID and S_IXGRP but not if the
    inode isn't in the caller's groups and the caller isn't privileged over the
    inode although we require this already in setattr_prepare() and
    setattr_copy() and so all filesystem implement this requirement implicitly
    because they have to use setattr_{prepare,copy}() anyway.

    But the inconsistency shows up in setgid stripping bugs for overlayfs in
    xfstests (e.g., generic/673, generic/683, generic/685, generic/686,
    generic/687). For example, we test whether suid and setgid stripping works
    correctly when performing various write-like operations as an unprivileged
    user (fallocate, reflink, write, etc.):

    echo "Test 1 - qa_user, non-exec file $verb"
    setup_testfile
    chmod a+rws $junk_file
    commit_and_check "$qa_user" "$verb" 64k 64k

    The test basically creates a file with 6666 permissions. While the file has
    the S_ISUID and S_ISGID bits set it does not have the S_IXGRP set. On a
    regular filesystem like xfs what will happen is:

    sys_fallocate()
    -> vfs_fallocate()
       -> xfs_file_fallocate()
          -> file_modified()
             -> __file_remove_privs()
                -> dentry_needs_remove_privs()
                   -> should_remove_suid()
                -> __remove_privs()
                   newattrs.ia_valid = ATTR_FORCE | kill;
                   -> notify_change()
                      -> setattr_copy()

    In should_remove_suid() we can see that ATTR_KILL_SUID is raised
    unconditionally because the file in the test has S_ISUID set.

    But we also see that ATTR_KILL_SGID won't be set because while the file
    is S_ISGID it is not S_IXGRP (see above) which is a condition for
    ATTR_KILL_SGID being raised.

    So by the time we call notify_change() we have attr->ia_valid set to
    ATTR_KILL_SUID | ATTR_FORCE. Now notify_change() sees that
    ATTR_KILL_SUID is set and does:

    ia_valid = attr->ia_valid |= ATTR_MODE
    attr->ia_mode = (inode->i_mode & ~S_ISUID);

    which means that when we call setattr_copy() later we will definitely
    update inode->i_mode. Note that attr->ia_mode still contains S_ISGID.

    Now we call into the filesystem's ->setattr() inode operation which will
    end up calling setattr_copy(). Since ATTR_MODE is set we will hit:

    if (ia_valid & ATTR_MODE) {
            umode_t mode = attr->ia_mode;
            vfsgid_t vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
            if (!vfsgid_in_group_p(vfsgid) &&
                !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
                    mode &= ~S_ISGID;
            inode->i_mode = mode;
    }

    and since the caller in the test is neither capable nor in the group of the
    inode the S_ISGID bit is stripped.

    But assume the file isn't suid then ATTR_KILL_SUID won't be raised which
    has the consequence that neither the setgid nor the suid bits are stripped
    even though it should be stripped because the inode isn't in the caller's
    groups and the caller isn't privileged over the inode.

    If overlayfs is in the mix things become a bit more complicated and the bug
    shows up more clearly. When e.g., ovl_setattr() is hit from
    ovl_fallocate()'s call to file_remove_privs() then ATTR_KILL_SUID and
    ATTR_KILL_SGID might be raised but because the check in notify_change() is
    questioning the ATTR_KILL_SGID flag again by requiring S_IXGRP for it to be
    stripped the S_ISGID bit isn't removed even though it should be stripped:

    sys_fallocate()
    -> vfs_fallocate()
       -> ovl_fallocate()
          -> file_remove_privs()
             -> dentry_needs_remove_privs()
                -> should_remove_suid()
             -> __remove_privs()
                newattrs.ia_valid = ATTR_FORCE | kill;
                -> notify_change()
                   -> ovl_setattr()
                      // TAKE ON MOUNTER'S CREDS
                      -> ovl_do_notify_change()
                         -> notify_change()
                      // GIVE UP MOUNTER'S CREDS
         // TAKE ON MOUNTER'S CREDS
         -> vfs_fallocate()
            -> xfs_file_fallocate()
               -> file_modified()
                  -> __file_remove_privs()
                     -> dentry_needs_remove_privs()
                        -> should_remove_suid()
                     -> __remove_privs()
                        newattrs.ia_valid = attr_force | kill;
                        -> notify_change()

    The fix for all of this is to make file_remove_privs()'s
    should_remove_suid() helper to perform the same checks as we already
    require in setattr_prepare() and setattr_copy() and have notify_change()
    not pointlessly requiring S_IXGRP again. It doesn't make any sense in the
    first place because the caller must calculate the flags via
    should_remove_suid() anyway which would raise ATTR_KILL_SGID.

    While we're at it we move should_remove_suid() from inode.c to attr.c
    where it belongs with the rest of the iattr helpers. Especially since it
    returns ATTR_KILL_S{G,U}ID flags. We also rename it to
    setattr_should_drop_suidgid() to better reflect that it indicates both
    setuid and setgid bit removal and also that it returns attr flags.

    Running xfstests with this doesn't report any regressions. We should really
    try and use consistent checks.

    Reviewed-by: Amir Goldstein <amir73il@gmail.com>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-15 16:12:34 +08:00
Ian Kent 505d96fd3e fuse: fixes after adapting to new posix acl api
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

commit facd61053cff100973921d4d45d47cf53c747ec6
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Jan 20 12:55:04 2023 +0100

    fuse: fixes after adapting to new posix acl api

    This cycle we ported all filesystems to the new posix acl api. While
    looking at further simplifications in this area to remove the last
    remnants of the generic dummy posix acl handlers we realized that we
    regressed fuse daemons that don't set FUSE_POSIX_ACL but still make use
    of posix acls.

    With the change to a dedicated posix acl api interacting with posix acls
    doesn't go through the old xattr codepaths anymore and instead only
    relies the get acl and set acl inode operations.

    Before this change fuse daemons that don't set FUSE_POSIX_ACL were able
    to get and set posix acl albeit with two caveats. First, that posix acls
    aren't cached. And second, that they aren't used for permission checking
    in the vfs.

    We regressed that use-case as we currently refuse to retrieve any posix
    acls if they aren't enabled via FUSE_POSIX_ACL. So older fuse daemons
    would see a change in behavior.

    We can restore the old behavior in multiple ways. We could change the
    new posix acl api and look for a dedicated xattr handler and if we find
    one prefer that over the dedicated posix acl api. That would break the
    consistency of the new posix acl api so we would very much prefer not to
    do that.

    We could introduce a new ACL_*_CACHE sentinel that would instruct the
    vfs permission checking codepath to not call into the filesystem and
    ignore acls.

    But a more straightforward fix for v6.2 is to do the same thing that
    Overlayfs does and give fuse a separate get acl method for permission
    checking. Overlayfs uses this to express different needs for vfs
    permission lookup and acl based retrieval via the regular system call
    path as well. Let fuse do the same for now. This way fuse can continue
    to refuse to retrieve posix acls for daemons that don't set
    FUSE_POSXI_ACL for permission checking while allowing a fuse server to
    retrieve it via the usual system calls.

    In the future, we could extend the get acl inode operation to not just
    pass a simple boolean to indicate rcu lookup but instead make it a flag
    argument. Then in addition to passing the information that this is an
    rcu lookup to the filesystem we could also introduce a flag that tells
    the filesystem that this is a request from the vfs to use these acls for
    permission checking. Then fuse could refuse the get acl request for
    permission checking when the daemon doesn't have FUSE_POSIX_ACL set in
    the same get acl method. This would also help Overlayfs and allow us to
    remove the second method for it as well.

    But since that change is more invasive as we need to update the get acl
    inode operation for multiple filesystems we should not do this as a fix
    for v6.2. Instead we will do this for the v6.3 merge window.

    Fwiw, since posix acls are now always correctly translated in the new
    posix acl api we could also allow them to be used for daemons without
    FUSE_POSIX_ACL that are not mounted on the host. But this is behavioral
    change and again if dones should be done for v6.3. For now, let's just
    restore the original behavior.

    A nice side-effect of this change is that for fuse daemons with and
    without FUSE_POSIX_ACL the same code is used for posix acls in a
    backwards compatible way. This also means we can remove the legacy xattr
    handlers completely. We've also added comments to explain the expected
    behavior for daemons without FUSE_POSIX_ACL into the code.

    Fixes: 318e66856dde ("xattr: use posix acl api")
    Signed-off-by: Seth Forshee (Digital Ocean) <sforshee@kernel.org>
    Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-15 16:12:08 +08:00
Ian Kent 2644928687 fuse: port to vfs{g,u}id_t and associated helpers
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

commit a03a972b26da2d30d1f3b3a72963191cd2938835
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Sep 9 11:40:21 2022 +0200

    fuse: port to vfs{g,u}id_t and associated helpers

    A while ago we introduced a dedicated vfs{g,u}id_t type in commit
    1e5267cd0895 ("mnt_idmapping: add vfs{g,u}id_t").  We already switched over
    a good part of the VFS.  Ultimately we will remove all legacy idmapped
    mount helpers that operate only on k{g,u}id_t in favor of the new type safe
    helpers that operate on vfs{g,u}id_t.

    Cc: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-15 16:12:07 +08:00
Ian Kent 4f5c324efc fs: rename current get acl method
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: Upstream commit eadcd6b5a1eb3 ("erofs: add fiemap support
    with iomap") is not (yet) present in CentOS Stream.
    The changes for fs/ksmbd/* were dropped as the directory doesn't
    exist in CentOS Stream.
    The changes for fs/ntfs3/* were dropped as the directory doesn't
    exist in CentOS Stream.

commit cac2f8b8d8b50ef32b3e34f6dcbbf08937e4f616
Author: Christian Brauner <brauner@kernel.org>
Date:   Thu Sep 22 17:17:00 2022 +0200

    fs: rename current get acl method

    The current way of setting and getting posix acls through the generic
    xattr interface is error prone and type unsafe. The vfs needs to
    interpret and fixup posix acls before storing or reporting it to
    userspace. Various hacks exist to make this work. The code is hard to
    understand and difficult to maintain in it's current form. Instead of
    making this work by hacking posix acls through xattr handlers we are
    building a dedicated posix acl api around the get and set inode
    operations. This removes a lot of hackiness and makes the codepaths
    easier to maintain. A lot of background can be found in [1].

    The current inode operation for getting posix acls takes an inode
    argument but various filesystems (e.g., 9p, cifs, overlayfs) need access
    to the dentry. In contrast to the ->set_acl() inode operation we cannot
    simply extend ->get_acl() to take a dentry argument. The ->get_acl()
    inode operation is called from:

    acl_permission_check()
    -> check_acl()
       -> get_acl()

    which is part of generic_permission() which in turn is part of
    inode_permission(). Both generic_permission() and inode_permission() are
    called in the ->permission() handler of various filesystems (e.g.,
    overlayfs). So simply passing a dentry argument to ->get_acl() would
    amount to also having to pass a dentry argument to ->permission(). We
    should avoid this unnecessary change.

    So instead of extending the existing inode operation rename it from
    ->get_acl() to ->get_inode_acl() and add a ->get_acl() method later that
    passes a dentry argument and which filesystems that need access to the
    dentry can implement instead of ->get_inode_acl(). Filesystems like cifs
    which allow setting and getting posix acls but not using them for
    permission checking during lookup can simply not implement
    ->get_inode_acl().

    This is intended to be a non-functional change.

    Link: https://lore.kernel.org/all/20220801145520.1532837-1-brauner@kernel.org [1]
    Suggested-by/Inspired-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-15 16:11:26 +08:00
Ian Kent 310906db16 fs: pass dentry to set acl method
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: I didn't want to just drop the btrfs hunks so I made the
    change to btrfs_setattr() init_user_ns instead of the expected
    mnt_userns. That should at least cause a conflict if btrfs changes
    to a supported fs in the future.
    CentOS Stream commit 48fa94aacd ("ceph: fscrypt_auth handling for
    ceph") is present, make necessary adjustment.
    CentOS Stream commit 892da692fa ("shmem: support idmapped mounts
    for tmpfs") is present, make necessary adjustment.
    The changes for fs/ksmbd/* were dropped as the directory doesn't
    exist in CentOS Stream.
    The changes for fs/ntfs3/* were dropped as the directory doesn't
    exist in CentOS Stream.

commit 138060ba92b3b0d77c8e6818d0f33398b23ea42e
Author: Christian Brauner <brauner@kernel.org>
Date:   Fri Sep 23 10:29:39 2022 +0200

    fs: pass dentry to set acl method

    The current way of setting and getting posix acls through the generic
    xattr interface is error prone and type unsafe. The vfs needs to
    interpret and fixup posix acls before storing or reporting it to
    userspace. Various hacks exist to make this work. The code is hard to
    understand and difficult to maintain in it's current form. Instead of
    making this work by hacking posix acls through xattr handlers we are
    building a dedicated posix acl api around the get and set inode
    operations. This removes a lot of hackiness and makes the codepaths
    easier to maintain. A lot of background can be found in [1].

    Since some filesystem rely on the dentry being available to them when
    setting posix acls (e.g., 9p and cifs) they cannot rely on set acl inode
    operation. But since ->set_acl() is required in order to use the generic
    posix acl xattr handlers filesystems that do not implement this inode
    operation cannot use the handler and need to implement their own
    dedicated posix acl handlers.

    Update the ->set_acl() inode method to take a dentry argument. This
    allows all filesystems to rely on ->set_acl().

    As far as I can tell all codepaths can be switched to rely on the dentry
    instead of just the inode. Note that the original motivation for passing
    the dentry separate from the inode instead of just the dentry in the
    xattr handlers was because of security modules that call
    security_d_instantiate(). This hook is called during
    d_instantiate_new(), d_add(), __d_instantiate_anon(), and
    d_splice_alias() to initialize the inode's security context and possibly
    to set security.* xattrs. Since this only affects security.* xattrs this
    is completely irrelevant for posix acls.

    Link: https://lore.kernel.org/all/20220801145520.1532837-1-brauner@kernel.org [1]
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-15 16:11:25 +08:00
Ian Kent 07a3bda2ba vfs: add rcu argument to ->get_acl() callback
JIRA: https://issues.redhat.com/browse/RHEL-33888
Status: Linus

Conflicts: CentOS Stream commit d592b7f96f ("9p: fix a bunch of
    checkpatch warnings") removes extern from declarations in
    fs/9p/acl.h.
    CentOS Stream commit 98ba731fc7 ("ovl: Move xattr support to
    new xattrs.c file") moved the declaration of ovl_xattr_get() and
    ovl_listxattr() to fs/overlayfs/xattr.c.
    CentOS Stream commit fdb679f7a3 ("xfs: improve __xfs_set_acl")
    changes the declarations in fs/xfs/xfs_acl.h.

commit 0cad6246621b5887d5b33fea84219d2a71f2f99a
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Wed Aug 18 22:08:24 2021 +0200

    vfs: add rcu argument to ->get_acl() callback

    Add a rcu argument to the ->get_acl() callback to allow
    get_cached_acl_rcu() to call the ->get_acl() method in the next patch.

    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-10-15 16:11:09 +08:00
Rafael Aquini 930d4bbabf mm: remove enum page_entry_size
JIRA: https://issues.redhat.com/browse/RHEL-27743
Conflicts:
  * fs/erofs/data.c: hunks dropped as RHEL is missing commit 06252e9ce05b
      ("erofs: dax support for non-tailpacking regular file")
  * fs/ext2/file.c: minor contex difference as RHEL is missing commit
      70f3bad8c315 ("ext2: Convert to using invalidate_lock")
  * fs/fuse/dax.c: minor contex difference as RHEL is missing commit
      8bcbbe9c7c8e ("fuse: Convert to using invalidate_lock")

This patch is a backport of the following upstream commit:
commit 1d024e7a8dabcc3c84d77532a88c774c32cf8245
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Fri Aug 18 21:23:35 2023 +0100

    mm: remove enum page_entry_size

    Remove the unnecessary encoding of page order into an enum and pass the
    page order directly.  That lets us get rid of pe_order().

    The switch constructs have to be changed to if/else constructs to prevent
    GCC from warning on builds with 3-level page tables where PMD_ORDER and
    PUD_ORDER have the same value.

    If you are looking at this commit because your driver stopped compiling,
    look at the previous commit as well and audit your driver to be sure it
    doesn't depend on mmap_lock being held in its ->huge_fault method.

    [willy@infradead.org: use "order %u" to match the (non dev_t) style]
      Link: https://lkml.kernel.org/r/ZOUYekbtTv+n8hYf@casper.infradead.org
    Link: https://lkml.kernel.org/r/20230818202335.2739663-4-willy@infradead.org
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Rafael Aquini <raquini@redhat.com>
2024-10-01 11:22:01 -04:00
CKI Backport Bot 3866ca7aba fuse: Initialize beyond-EOF page contents before setting uptodate
JIRA: https://issues.redhat.com/browse/RHEL-56932
CVE: CVE-2024-44947

commit 3c0da3d163eb32f1f91891efaade027fa9b245b9
Author: Jann Horn <jannh@google.com>
Date:   Tue Aug 6 21:51:42 2024 +0200

    fuse: Initialize beyond-EOF page contents before setting uptodate

    fuse_notify_store(), unlike fuse_do_readpage(), does not enable page
    zeroing (because it can be used to change partial page contents).

    So fuse_notify_store() must be more careful to fully initialize page
    contents (including parts of the page that are beyond end-of-file)
    before marking the page uptodate.

    The current code can leave beyond-EOF page contents uninitialized, which
    makes these uninitialized page contents visible to userspace via mmap().

    This is an information leak, but only affects systems which do not
    enable init-on-alloc (via CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y or the
    corresponding kernel command line parameter).

    Link: https://bugs.chromium.org/p/project-zero/issues/detail?id=2574
    Cc: stable@kernel.org
    Fixes: a1d75f2582 ("fuse: add store request")
    Signed-off-by: Jann Horn <jannh@google.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
2024-09-03 06:17:02 +00:00
Jeff Moyer 95e03aeb98 dax: enable dax fault handler to report VM_FAULT_HWPOISON
JIRA: https://issues.redhat.com/browse/RHEL-23824

commit 1ea7ca1b090145519aad998679222f0a14ab8fce
Author: Jane Chu <jane.chu@oracle.com>
Date:   Thu Jun 15 12:13:25 2023 -0600

    dax: enable dax fault handler to report VM_FAULT_HWPOISON
    
    When multiple processes mmap() a dax file, then at some point,
    a process issues a 'load' and consumes a hwpoison, the process
    receives a SIGBUS with si_code = BUS_MCEERR_AR and with si_lsb
    set for the poison scope. Soon after, any other process issues
    a 'load' to the poisoned page (that is unmapped from the kernel
    side by memory_failure), it receives a SIGBUS with
    si_code = BUS_ADRERR and without valid si_lsb.
    
    This is confusing to user, and is different from page fault due
    to poison in RAM memory, also some helpful information is lost.
    
    Channel dax backend driver's poison detection to the filesystem
    such that instead of reporting VM_FAULT_SIGBUS, it could report
    VM_FAULT_HWPOISON.
    
    If user level block IO syscalls fail due to poison, the errno will
    be converted to EIO to maintain block API consistency.
    
    Signed-off-by: Jane Chu <jane.chu@oracle.com>
    Link: https://lore.kernel.org/r/20230615181325.1327259-2-jane.chu@oracle.com
    Reviewed-by: Dan Williams <dan.j.williams@intel.com>
    Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2024-07-26 14:52:28 -04:00
Lucas Zampieri 938973889b Merge: virtiofs: sync to upstream v6.9
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4120

JIRA: https://issues.redhat.com/browse/RHEL-34071  
Upstream Status: linux.git  
Tested: via fstests and local testing.  
  
Signed-off-by: Brian Foster <bfoster@redhat.com>

Approved-by: Bill O'Donnell <bodonnel@redhat.com>
Approved-by: Ian Kent <ikent@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Lucas Zampieri <lzampier@redhat.com>
2024-06-25 13:26:13 +00:00
Lucas Zampieri 5739ae2afe Merge: Rebase kexec/kdump to upstream kernel v6.5
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4053

```
JIRA: https://issues.redhat.com/browse/RHEL-32199
Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

This rebase kexec/kdump of rhel9 kernel to v6.5 of mainline kernel. This is for rhel9.5. Last time rebase was done in rhel9.2 and synchronized to v6.0.

Signed-off-by: Baoquan He <bhe@redhat.com>
```

Approved-by: Vladis Dronov <vdronov@redhat.com>
Approved-by: Rafael Aquini <aquini@redhat.com>
Approved-by: Lenny Szubowicz <lszubowi@redhat.com>
Approved-by: Lichen Liu <lichliu@redhat.com>
Approved-by: Tao Liu <ltao@redhat.com>
Approved-by: Pingfan Liu <piliu@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Lucas Zampieri <lzampier@redhat.com>
2024-05-27 13:52:25 +00:00
Baoquan He 78ef223d06 use less confusing names for iov_iter direction initializers
JIRA: https://issues.redhat.com/browse/RHEL-32199

Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Note: The core of this patch was already backported in commit 0d33f8e1f3.
      And later commit a9e6d7970e back ported cifs part. This patch tries
      to back port the remaining parts which doesn't have conficts. This
      change is easing code reading and understanding, not related to
      functionality or features, hence leave those parts to module developer
      to back port when dependency is met.

commit de4eda9de2d957ef2d6a8365a01e26a435e958cb
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Thu Sep 15 20:25:47 2022 -0400

    use less confusing names for iov_iter direction initializers

    READ/WRITE proved to be actively confusing - the meanings are
    "data destination, as used with read(2)" and "data source, as
    used with write(2)", but people keep interpreting those as
    "we read data from it" and "we write data to it", i.e. exactly
    the wrong way.

    Call them ITER_DEST and ITER_SOURCE - at least that is harder
    to misinterpret...

    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Signed-off-by: Baoquan He <bhe@redhat.com>
2024-05-15 13:56:26 +08:00
Brian Foster 900b7e8a82 virtiofs: include a newline in sysfs tag
JIRA: https://issues.redhat.com/browse/RHEL-34071

commit 96d88f65adfbcaca153afd7d3e20d74ba379c599
Author: Brian Foster <bfoster@redhat.com>
Date:   Thu Apr 25 06:44:00 2024 -0400

    virtiofs: include a newline in sysfs tag

    The internal tag string doesn't contain a newline. Append one when
    emitting the tag via sysfs.

    [Stefan] Orthogonal to the newline issue, sysfs_emit(buf, "%s", fs->tag) is
    needed to prevent format string injection.

    Signed-off-by: Brian Foster <bfoster@redhat.com>
    Fixes: a8f62f50b4e4 ("virtiofs: export filesystem tags through sysfs")
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2024-05-10 13:33:13 -04:00
Brian Foster f88640c7da virtio_fs: remove duplicate check if queue is broken
JIRA: https://issues.redhat.com/browse/RHEL-34071

commit f9c29137392e77319f9974c2cdf27d087f05abee
Author: Li RongQing <lirongqing@baidu.com>
Date:   Mon Jan 15 11:09:14 2024 +0800

    virtio_fs: remove duplicate check if queue is broken

    virtqueue_enable_cb() will call virtqueue_poll() which will check if
    queue is broken at beginning, so remove the virtqueue_is_broken() call

    Signed-off-by: Li RongQing <lirongqing@baidu.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2024-05-10 13:33:13 -04:00
Brian Foster 5d2820e5ba virtiofs: drop __exit from virtio_fs_sysfs_exit()
JIRA: https://issues.redhat.com/browse/RHEL-34071

commit d30ff89870482d88807393b592d5f0d1d4bc5e2a
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date:   Tue Feb 27 10:57:56 2024 -0500

    virtiofs: drop __exit from virtio_fs_sysfs_exit()

    virtio_fs_sysfs_exit() is called by:
    - static int __init virtio_fs_init(void)
    - static void __exit virtio_fs_exit(void)

    Remove __exit from virtio_fs_sysfs_exit() since virtio_fs_init() is not
    an __exit function.

    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202402270649.GYjNX0yw-lkp@intel.com/
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
    Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2024-05-10 13:33:13 -04:00
Brian Foster dcb35c5787 virtiofs: emit uevents on filesystem events
JIRA: https://issues.redhat.com/browse/RHEL-34071

commit 9086b2d9e9f3da0b0f939aa1d7ff74e9bf5b54c8
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date:   Mon Feb 12 19:11:49 2024 -0500

    virtiofs: emit uevents on filesystem events

    Alyssa Ross <hi@alyssa.is> requested that virtiofs notifies userspace
    when filesytems become available. This can be used to detect when a
    filesystem with a given tag is hotplugged, for example. uevents allow
    userspace to detect changes without resorting to polling.

    The tag is included as a uevent property so it's easy for userspace to
    identify the filesystem in question even when the sysfs directory goes
    away during removal.

    Here are example uevents:

      # udevadm monitor -k -p

      KERNEL[111.113221] add      /fs/virtiofs/2 (virtiofs)
      ACTION=add
      DEVPATH=/fs/virtiofs/2
      SUBSYSTEM=virtiofs
      TAG=test

      KERNEL[165.527167] remove   /fs/virtiofs/2 (virtiofs)
      ACTION=remove
      DEVPATH=/fs/virtiofs/2
      SUBSYSTEM=virtiofs
      TAG=test

    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2024-05-10 13:33:13 -04:00
Brian Foster d007b703e2 virtiofs: export filesystem tags through sysfs
JIRA: https://issues.redhat.com/browse/RHEL-34071

commit a8f62f50b4e4ea92a938fca2ec1bd108d7f210e9
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date:   Mon Feb 12 19:11:48 2024 -0500

    virtiofs: export filesystem tags through sysfs

    The virtiofs filesystem is mounted using a "tag" which is exported by
    the virtiofs device:

      # mount -t virtiofs <tag> /mnt

    The virtiofs driver knows about all the available tags but these are
    currently not exported to user space.

    People have asked for these tags to be exported to user space. Most
    recently Lennart Poettering has asked for it as he wants to scan the
    tags and mount virtiofs automatically in certain cases.

    https://gitlab.com/virtio-fs/virtiofsd/-/issues/128

    This patch exports tags at /sys/fs/virtiofs/<N>/tag where N is the id of
    the virtiofs device. The filesystem tag can be obtained by reading this
    "tag" file.

    There is also a symlink at /sys/fs/virtiofs/<N>/device that points to
    the virtiofs device that exports this tag.

    This patch converts the existing struct virtio_fs into a full kobject.
    It already had a refcount so it's an easy change. The virtio_fs objects
    can then be exposed in a kset at /sys/fs/virtiofs/. Note that virtio_fs
    objects may live slightly longer than we wish for them to be exposed to
    userspace, so kobject_del() is called explicitly when the underlying
    virtio_device is removed. The virtio_fs object is freed when all
    references are dropped (e.g. active mounts) but disappears as soon as
    the virtiofs device is gone.

    Originally-by: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2024-05-10 13:33:12 -04:00
Brian Foster 1720392357 virtiofs: forbid newlines in tags
JIRA: https://issues.redhat.com/browse/RHEL-34071

commit 40488cc16f7ea0d193a4e248f0d809c25cc377db
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date:   Mon Feb 12 19:11:47 2024 -0500

    virtiofs: forbid newlines in tags

    Newlines in virtiofs tags are awkward for users and potential vectors
    for string injection attacks.

    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Brian Foster <bfoster@redhat.com>
2024-05-10 13:33:12 -04:00
Nico Pache 168fb63082 fuse: remove unneeded lock which protecting update of congestion_threshold
commit efc4105a4cf9e300b8e9150147415fa235059293
Author: Kemeng Shi <shikemeng@huaweicloud.com>
Date:   Sat Oct 7 23:39:56 2023 +0800

    fuse: remove unneeded lock which protecting update of congestion_threshold

    Commit 670d21c6e17f6 ("fuse: remove reliance on bdi congestion") change how
    congestion_threshold is used and lock in
    fuse_conn_congestion_threshold_write is not needed anymore.
    1. Access to supe_block is removed along with removing of bdi congestion.
    Then down_read(&fc->killsb) which protecting access to super_block is no
    needed.
    2. Compare num_background and congestion_threshold without holding
    bg_lock. Then there is no need to hold bg_lock to update
    congestion_threshold.

    Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

JIRA: https://issues.redhat.com/browse/RHEL-5619
Signed-off-by: Nico Pache <npache@redhat.com>
2024-04-30 17:51:33 -06:00
Nico Pache cab0fc3481 fuse: remove reliance on bdi congestion
commit 670d21c6e17f67535fcf16e14c772209220da9ae
Author: NeilBrown <neilb@suse.de>
Date:   Tue Mar 22 14:38:58 2022 -0700

    fuse: remove reliance on bdi congestion

    The bdi congestion tracking in not widely used and will be removed.

    Fuse is one of a small number of filesystems that uses it, setting both
    the sync (read) and async (write) congestion flags at what it determines
    are appropriate times.

    The only remaining effect of the sync flag is to cause read-ahead to be
    skipped.  The only remaining effect of the async flag is to cause (some)
    WB_SYNC_NONE writes to be skipped.

    So instead of setting the flags, change:

     - .readahead to stop when it has submitted all non-async pages for
       read.

     - .writepages to do nothing if WB_SYNC_NONE and the flag would be set

     - .writepage to return AOP_WRITEPAGE_ACTIVATE if WB_SYNC_NONE and the
       flag would be set.

    The writepages change causes a behavioural change in that pageout() can
    now return PAGE_ACTIVATE instead of PAGE_KEEP, so SetPageActive() will be
    called on the page which (I think) will further delay the next attempt at
    writeout.  This might be a good thing.

    Link: https://lkml.kernel.org/r/164549983737.9187.2627117501000365074.stgit@noble.brown
    Signed-off-by: NeilBrown <neilb@suse.de>
    Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Cc: Chao Yu <chao@kernel.org>
    Cc: Darrick J. Wong <djwong@kernel.org>
    Cc: Ilya Dryomov <idryomov@gmail.com>
    Cc: Jaegeuk Kim <jaegeuk@kernel.org>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Jeff Layton <jlayton@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
    Cc: Miklos Szeredi <miklos@szeredi.hu>
    Cc: Paolo Valente <paolo.valente@linaro.org>
    Cc: Philipp Reisner <philipp.reisner@linbit.com>
    Cc: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
    Cc: Wu Fengguang <fengguang.wu@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

JIRA: https://issues.redhat.com/browse/RHEL-5619
Signed-off-by: Nico Pache <npache@redhat.com>
2024-04-30 17:51:31 -06:00
Aristeu Rozanski e214620cfb mm: replace vma->vm_flags direct modifications with modifier calls
JIRA: https://issues.redhat.com/browse/RHEL-27740
Tested: by me
Conflicts: dropped stuff we don't support when not applying cleanly, left the rest for sake of saving work

commit 1c71222e5f2393b5ea1a41795c67589eea7e3490
Author: Suren Baghdasaryan <surenb@google.com>
Date:   Thu Jan 26 11:37:49 2023 -0800

    mm: replace vma->vm_flags direct modifications with modifier calls

    Replace direct modifications to vma->vm_flags with calls to modifier
    functions to be able to track flag changes and to keep vma locking
    correctness.

    [akpm@linux-foundation.org: fix drivers/misc/open-dice.c, per Hyeonggon Yoo]
    Link: https://lkml.kernel.org/r/20230126193752.297968-5-surenb@google.com
    Signed-off-by: Suren Baghdasaryan <surenb@google.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
    Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
    Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Arjun Roy <arjunroy@google.com>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Greg Thelen <gthelen@google.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jann Horn <jannh@google.com>
    Cc: Joel Fernandes <joelaf@google.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Kent Overstreet <kent.overstreet@linux.dev>
    Cc: Laurent Dufour <ldufour@linux.ibm.com>
    Cc: Lorenzo Stoakes <lstoakes@gmail.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Minchan Kim <minchan@google.com>
    Cc: Paul E. McKenney <paulmck@kernel.org>
    Cc: Peter Oskolkov <posk@google.com>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Punit Agrawal <punit.agrawal@bytedance.com>
    Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Cc: Shakeel Butt <shakeelb@google.com>
    Cc: Soheil Hassas Yeganeh <soheil@google.com>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Will Deacon <will@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
2024-04-29 14:33:17 -04:00
Aristeu Rozanski 5a6ac04952 fs: convert writepage_t callback to pass a folio
JIRA: https://issues.redhat.com/browse/RHEL-27740
Tested: by me
Conflicts: mpage_writepage() still exists, so update it to use __mpage_writepage() with folio, 0c493b5cf16e2 was backported already, so update fs/nfs/write changes accordingly; dropped ntfs3 changes as we don't support it; adding fix present on merge 3822a7c40997 for gfs2

commit d585bdbeb79aa13b8a9bbe952d90f5252f7fe909
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Thu Jan 26 20:12:54 2023 +0000

    fs: convert writepage_t callback to pass a folio

    Patch series "Convert writepage_t to use a folio".

    More folioisation.  I split out the mpage work from everything else
    because it completely dominated the patch, but some implementations I just
    converted outright.

    This patch (of 2):

    We always write back an entire folio, but that's currently passed as the
    head page.  Convert all filesystems that use write_cache_pages() to expect
    a folio instead of a page.

    Link: https://lkml.kernel.org/r/20230126201255.1681189-1-willy@infradead.org
    Link: https://lkml.kernel.org/r/20230126201255.1681189-2-willy@infradead.org
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Christoph Hellwig <hch@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
2024-04-29 14:33:13 -04:00
Ming Lei 69700d9e97 fuse: drop redundant arguments to fuse_perform_write
JIRA: https://issues.redhat.com/browse/RHEL-29564

commit 596df33d673d9d816b60b95088e59a76d845c254
Author: Christoph Hellwig <hch@lst.de>
Date:   Thu Jun 1 16:59:03 2023 +0200

    fuse: drop redundant arguments to fuse_perform_write

    pos is always equal to iocb->ki_pos, and mapping is always equal to
    iocb->ki_filp->f_mapping.

    Link: https://lkml.kernel.org/r/20230601145904.1385409-12-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Acked-by: Miklos Szeredi <mszeredi@redhat.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Andreas Gruenbacher <agruenba@redhat.com>
    Cc: Anna Schumaker <anna@kernel.org>
    Cc: Chao Yu <chao@kernel.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: "Darrick J. Wong" <djwong@kernel.org>
    Cc: Ilya Dryomov <idryomov@gmail.com>
    Cc: Jaegeuk Kim <jaegeuk@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Miklos Szeredi <miklos@szeredi.hu>
    Cc: Theodore Ts'o <tytso@mit.edu>
    Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
    Cc: Xiubo Li <xiubli@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2024-04-17 10:04:41 +08:00
Ming Lei 4669357972 fuse: update ki_pos in fuse_perform_write
JIRA: https://issues.redhat.com/browse/RHEL-29564

commit 70e986c3b4f43ae7096be6de9a39c947f182e0c0
Author: Christoph Hellwig <hch@lst.de>
Date:   Thu Jun 1 16:59:02 2023 +0200

    fuse: update ki_pos in fuse_perform_write

    Both callers of fuse_perform_write need to updated ki_pos, move it into
    common code.

    Link: https://lkml.kernel.org/r/20230601145904.1385409-11-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Andreas Gruenbacher <agruenba@redhat.com>
    Cc: Anna Schumaker <anna@kernel.org>
    Cc: Chao Yu <chao@kernel.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: "Darrick J. Wong" <djwong@kernel.org>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Ilya Dryomov <idryomov@gmail.com>
    Cc: Jaegeuk Kim <jaegeuk@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Miklos Szeredi <miklos@szeredi.hu>
    Cc: Miklos Szeredi <mszeredi@redhat.com>
    Cc: Theodore Ts'o <tytso@mit.edu>
    Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
    Cc: Xiubo Li <xiubli@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2024-04-17 10:04:41 +08:00
Ming Lei 80c8d8c3fd backing_dev: remove current->backing_dev_info
JIRA: https://issues.redhat.com/browse/RHEL-29564
Conflicts: drop f2fs and ntfs2 changes

commit 0d625446d0a451a683a357799912b9e688629707
Author: Christoph Hellwig <hch@lst.de>
Date:   Thu Jun 1 16:58:53 2023 +0200

    backing_dev: remove current->backing_dev_info

    Patch series "cleanup the filemap / direct I/O interaction", v4.

    This series cleans up some of the generic write helper calling conventions
    and the page cache writeback / invalidation for direct I/O.  This is a
    spinoff from the no-bufferhead kernel project, for which we'll want to an
    use iomap based buffered write path in the block layer.

    This patch (of 12):

    The last user of current->backing_dev_info disappeared in commit
    b9b1335e6403 ("remove bdi_congested() and wb_congested() and related
    functions").  Remove the field and all assignments to it.

    Link: https://lkml.kernel.org/r/20230601145904.1385409-1-hch@lst.de
    Link: https://lkml.kernel.org/r/20230601145904.1385409-2-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Christian Brauner <brauner@kernel.org>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: Darrick J. Wong <djwong@kernel.org>
    Acked-by: Theodore Ts'o <tytso@mit.edu>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Andreas Gruenbacher <agruenba@redhat.com>
    Cc: Anna Schumaker <anna@kernel.org>
    Cc: Chao Yu <chao@kernel.org>
    Cc: Ilya Dryomov <idryomov@gmail.com>
    Cc: Jaegeuk Kim <jaegeuk@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Miklos Szeredi <miklos@szeredi.hu>
    Cc: Miklos Szeredi <mszeredi@redhat.com>
    Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
    Cc: Xiubo Li <xiubli@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2024-04-17 10:04:36 +08:00
Scott Weaver 09756f6014 Merge: block: 9.5 update take 2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3864

JIRA: https://issues.redhat.com/browse/RHEL-29262

Depends: https://issues.redhat.com/browse/RHEL-25988

Depends: !3822

Signed-off-by: Ming Lei <ming.lei@redhat.com>

Approved-by: Jeff Moyer <jmoyer@redhat.com>
Approved-by: Nico Pache <npache@redhat.com>

Merged-by: Scott Weaver <scweaver@redhat.com>
2024-03-29 09:44:24 -04:00
Prarit Bhargava ae6b867efe x86: Remove toolchain check for X32 ABI capability
JIRA: https://issues.redhat.com/browse/RHEL-25415

commit 83a44a4f47ad20997aebb311fc678a13cde391d7
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Mon Mar 14 12:48:41 2022 -0700

    x86: Remove toolchain check for X32 ABI capability

    Commit 0bf6276392 ("x32: Warn and disable rather than error if
    binutils too old") added a small test in arch/x86/Makefile because
    binutils 2.22 or newer is needed to properly support elf32-x86-64. This
    check is no longer necessary, as the minimum supported version of
    binutils is 2.23, which is enforced at configuration time with
    scripts/min-tool-version.sh.

    Remove this check and replace all uses of CONFIG_X86_X32 with
    CONFIG_X86_X32_ABI, as two symbols are no longer necessary.

    [nathan: Rebase, fix up a few places where CONFIG_X86_X32 was still
             used, and simplify commit message to satisfy -tip requirements]

    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20220314194842.3452-2-nathan@kernel.org

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
2024-03-20 09:42:29 -04:00
Ming Lei bf114839c4 fuse: retire block-device-based superblock on force unmount
JIRA: https://issues.redhat.com/browse/RHEL-29262

commit 247861c325c2e4f5ad3c2f9a77ab9d85d15cbcfc
Author: Daniil Lunev <dlunev@chromium.org>
Date:   Wed Jul 27 16:44:25 2022 +1000

    fuse: retire block-device-based superblock on force unmount

    Force unmount of FUSE severes the connection with the user space, even if
    there are still open files.  Subsequent remount tries to re-use the
    superblock held by the open files, which is meaningless in the FUSE case
    after disconnect - reused super block doesn't have userspace counterpart
    attached to it and is incapable of doing any IO.

    This patch adds the functionality only for the block-device-based supers,
    since the primary use case of the feature is to gracefully handle force
    unmount of external devices, mounted with FUSE.  This can be further
    extended to cover all superblocks, if the need arises.

    Signed-off-by: Daniil Lunev <dlunev@chromium.org>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2024-03-19 10:07:42 +08:00
Scott Weaver 8d95883db0 Merge: io_uring: update to upstream v6.6
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3318

Update io_uring and its dependencies to upstream kernel version 6.6.

JIRA: https://issues.redhat.com/browse/RHEL-12076
JIRA: https://issues.redhat.com/browse/RHEL-14998
JIRA: https://issues.redhat.com/browse/RHEL-4447
CVE: CVE-2023-46862

Omitted-Fix: ab69838e7c75 ("io_uring/kbuf: Fix check of BID wrapping in provided buffers")
Omitted-Fix: f74c746e476b ("io_uring/kbuf: Allow the full buffer id space for provided buffers")

This is the list of new features available (includes upstream kernel versions 6.3-6.6):

    User-specified ring buffer
    Provided Buffers allocated by the kernel
    Ability to register the ring fd
    Multi-shot timeouts
    ability to pass custom flags to the completion queue entry for ring messages

All of these features are covered by the liburing tests.

In my testing, no-mmap-inval.t failed because of a broken test.  socket-uring-cmd.t also failed because of a missing selinux policy rule.  Try running audit2allow if you see a failure in that test.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

Approved-by: Wander Lairson Costa <wander@redhat.com>
Approved-by: Donald Dutile <ddutile@redhat.com>
Approved-by: Chris von Recklinghausen <crecklin@redhat.com>
Approved-by: Jiri Benc <jbenc@redhat.com>
Approved-by: Ming Lei <ming.lei@redhat.com>

Signed-off-by: Scott Weaver <scweaver@redhat.com>
2023-12-16 14:38:47 -05:00
Jan Stancek 151f2a0ce1 Merge: update drivers/base to v6.4
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2940

JIRA: https://issues.redhat.com/browse/RHEL-1023

Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>

Approved-by: Phil Auld <pauld@redhat.com>
Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: Antoine Tenart <atenart@redhat.com>
Approved-by: Jocelyn Falempe <jfalempe@redhat.com>
Approved-by: Chris von Recklinghausen <crecklin@redhat.com>
Approved-by: Prarit Bhargava <prarit@redhat.com>
Approved-by: John W. Linville <linville@redhat.com>
Approved-by: Vladis Dronov <vdronov@redhat.com>
Approved-by: Donald Dutile <ddutile@redhat.com>
Approved-by: Eric Chanudet <echanude@redhat.com>

Signed-off-by: Jan Stancek <jstancek@redhat.com>
2023-11-19 13:07:01 +01:00
Jeff Moyer cc3954e1d4 iov_iter: add iter_iovec() helper
JIRA: https://issues.redhat.com/browse/RHEL-12076

commit de4f5fed3f231a8ff4790bf52975f847b95b85ea
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed Mar 29 08:52:15 2023 -0600

    iov_iter: add iter_iovec() helper
    
    This returns a pointer to the current iovec entry in the iterator. Only
    useful with ITER_IOVEC right now, but it prepares us to treat ITER_UBUF
    and ITER_IOVEC identically for the first segment.
    
    Rename struct iov_iter->iov to iov_iter->__iov to find any potentially
    troublesome spots, and also to prevent anyone from adding new code that
    accesses iter->iov directly.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2023-11-02 15:31:27 -04:00
Mark Langsdorf 094c7e2822 driver core: class: remove module * from class_create()
JIRA: https://issues.redhat.com/browse/RHEL-1023
Conflicts:
	drivers/dax/bus.c - had to remove an argument
by hand
	drivers/char/tpm/tpm-interface.c - minor context
differences

commit 1aaba11da9aa7d7d6b52a74d45b31cac118295a1
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Fri, 17 Mar 2023 15:16:33 +0000

The module pointer in class_create() never actually did anything, and it
shouldn't have been requred to be set as a parameter even if it did
something.  So just remove it and fix up all callers of the function in
the kernel tree at the same time.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20230313181843.1207845-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
2023-11-01 11:12:29 -05:00