[PATCH v7.3 4/9] cifs: Validate presence of EA $LXMOD for WSL reparse points
From: Pali Rohár
Date: Mon Oct 26 2026 - 18:26:19 EST
S_DT part of xattr $LXMOD is mandatory for all WSL reparse points except the
WSL symlink and Win32 socket. Microsoft WSL subsystem does not recognize
them without xattr $LXMOD too, and treat such inodes as regular files.
Fixes: ef201e8759d2 ("cifs: Validate EAs for WSL reparse points")
Fixes: 78e26bec4d6d ("smb: client: parse uid, gid, mode and dev from WSL reparse points")
Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
---
fs/smb/client/reparse.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
index e547510ca3c5..577cdf49c047 100644
--- a/fs/smb/client/reparse.c
+++ b/fs/smb/client/reparse.c
@@ -1153,6 +1153,7 @@ static bool wsl_to_fattr(struct cifs_open_info_data *data,
kgid_t gid = cifs_sb->ctx->linux_gid;
struct smb2_file_full_ea_info *ea;
bool ignore_missing_eas = false;
+ bool have_xattr_mode = false;
bool have_xattr_dev = false;
dev_t rdev = 0;
umode_t mode;
@@ -1216,6 +1217,7 @@ static bool wsl_to_fattr(struct cifs_open_info_data *data,
if (S_DT(mode) != S_DT(get_unaligned_le32(v)))
return false;
mode = get_unaligned_le32(v);
+ have_xattr_mode = true;
} else if (!strncmp(name, SMB2_WSL_XATTR_DEV, nlen)) {
rdev = reparse_mkdev(v);
have_xattr_dev = true;
@@ -1226,6 +1228,16 @@ static bool wsl_to_fattr(struct cifs_open_info_data *data,
if (!have_xattr_dev && (tag == IO_REPARSE_TAG_LX_CHR || tag == IO_REPARSE_TAG_LX_BLK))
return ignore_missing_eas;
+ /*
+ * S_DT part of xattr MODE is mandatory for all WSL reparse points except the WSL symlink.
+ * Microsoft WSL does not recognize them without xattr MODE too (except the WSL symlink).
+ * IO_REPARSE_TAG_AF_UNIX is here an exception because this reparse point is used by both
+ * WSL subsystem and native NT/WinAPI subsystems. And NT/WinAPI creates AF UNIX socket
+ * without the xattr MODE and recognize it also without the xattr MODE.
+ */
+ if (!have_xattr_mode && (tag != IO_REPARSE_TAG_AF_UNIX && tag != IO_REPARSE_TAG_LX_SYMLINK))
+ return ignore_missing_eas;
+
fattr->cf_uid = uid;
fattr->cf_gid = gid;
fattr->cf_mode = mode;
--
2.20.1