From: Greg Kroah-Hartman Date: Wed, 1 Jul 2026 13:35:02 +0000 (+0200) Subject: 6.12-stable patches X-Git-Tag: v5.10.260~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36755e2f26a79a7afbf7b1281a69e755a32e8941;p=thirdparty%2Fkernel%2Fstable-queue.git 6.12-stable patches added patches: ntfs3-reject-direct-userspace-writes-to-reserved-lx-xattrs.patch --- diff --git a/queue-6.12/ntfs3-reject-direct-userspace-writes-to-reserved-lx-xattrs.patch b/queue-6.12/ntfs3-reject-direct-userspace-writes-to-reserved-lx-xattrs.patch new file mode 100644 index 0000000000..1ca7f8d2a0 --- /dev/null +++ b/queue-6.12/ntfs3-reject-direct-userspace-writes-to-reserved-lx-xattrs.patch @@ -0,0 +1,58 @@ +From 5b08dccecf825cbf905f348bc6ccb497507e28e2 Mon Sep 17 00:00:00 2001 +From: Konstantin Komarov +Date: Wed, 10 Jun 2026 12:31:01 +0200 +Subject: ntfs3: reject direct userspace writes to reserved $LX* xattrs + +From: Konstantin Komarov + +commit 5b08dccecf825cbf905f348bc6ccb497507e28e2 upstream. + +NTFS3 uses $LXUID, $LXGID, $LXMOD and $LXDEV as internal WSL +permission metadata and reloads them into i_uid, i_gid and i_mode +from ntfs_get_wsl_perm(). + +Because the empty-prefix xattr handler also lets file owners call +setxattr() on these names directly, an unprivileged writer on a +writable ntfs3 mount can plant root ownership and S_ISUID on their own +file and gain euid 0 after inode reload. + +Reject direct userspace writes to the reserved $LX* names. Internal +ntfs3 metadata updates are unchanged because ntfs_save_wsl_perm() +writes them via ntfs_set_ea() directly. + +Signed-off-by: Zhen Yan +[almaz.alexandrovich@paragon-software.com: added an additional check for non privileged users] +Signed-off-by: Konstantin Komarov +Signed-off-by: Greg Kroah-Hartman +--- + fs/ntfs3/xattr.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/fs/ntfs3/xattr.c ++++ b/fs/ntfs3/xattr.c +@@ -829,6 +829,12 @@ out: + return err; + } + ++static bool ntfs_is_reserved_lxattr(const char *name) ++{ ++ return !strcmp(name, "$LXUID") || !strcmp(name, "$LXGID") || ++ !strcmp(name, "$LXMOD") || !strcmp(name, "$LXDEV"); ++} ++ + /* + * ntfs_setxattr - inode_operations::setxattr + */ +@@ -933,6 +939,12 @@ set_new_fa: + goto out; + } + ++ /* Do not allow non privileged users to change $LXUID/$LXGID... */ ++ if (ntfs_is_reserved_lxattr(name) && !capable(CAP_SYS_ADMIN)) { ++ err = -EPERM; ++ goto out; ++ } ++ + /* Deal with NTFS extended attribute. */ + err = ntfs_set_ea(inode, name, strlen(name), value, size, flags, 0, + NULL); diff --git a/queue-6.12/series b/queue-6.12/series index a876d12321..89b3f905f0 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -127,3 +127,4 @@ lsm-add-backing_file-lsm-hooks.patch selinux-fix-overlayfs-mmap-and-mprotect-access-check.patch inet-add-indirect-call-wrapper-for-getfrag-calls.patch ipv4-account-for-fraggap-on-the-paged-allocation-pat.patch +ntfs3-reject-direct-userspace-writes-to-reserved-lx-xattrs.patch