aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeizhao Ouyang <o451686892@gmail.com>2023-04-20 17:27:39 +0800
committerGao Xiang <hsiangkao@linux.alibaba.com>2023-04-20 17:39:30 +0800
commit2f4e32fb2cc15578085ad7750f4aa09edecbf4f2 (patch)
treea289b2c0452009fac552623f54cbf86aecc59534
parent9e37a7a5f90195fa763e704e4c0fa22f1d5fc0bf (diff)
downloaderofs-utils-2f4e32fb2cc15578085ad7750f4aa09edecbf4f2.tar.gz
erofs-utils: xattr: skip xattrs with unidentified "system." prefix
Skip xattrs with unidentified "system." prefix to avoid ENODATA error. Such as building AOSP on NFSv4 servers. Signed-off-by: Weizhao Ouyang <o451686892@gmail.com> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20230420092739.75464-1-o451686892@gmail.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
-rw-r--r--include/erofs/xattr.h6
-rw-r--r--lib/xattr.c12
2 files changed, 18 insertions, 0 deletions
diff --git a/include/erofs/xattr.h b/include/erofs/xattr.h
index 9efadc5..de078a5 100644
--- a/include/erofs/xattr.h
+++ b/include/erofs/xattr.h
@@ -41,6 +41,12 @@ static inline unsigned int xattrblock_offset(unsigned int xattr_id)
(_size - sizeof(struct erofs_xattr_ibody_header)) / \
sizeof(struct erofs_xattr_entry) + 1; })
+#ifndef XATTR_SYSTEM_PREFIX
+#define XATTR_SYSTEM_PREFIX "system."
+#endif
+#ifndef XATTR_SYSTEM_PREFIX_LEN
+#define XATTR_SYSTEM_PREFIX_LEN (sizeof(XATTR_SYSTEM_PREFIX) - 1)
+#endif
#ifndef XATTR_USER_PREFIX
#define XATTR_USER_PREFIX "user."
#endif
diff --git a/lib/xattr.c b/lib/xattr.c
index 6034e7b..7c77633 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -288,6 +288,18 @@ static bool erofs_is_skipped_xattr(const char *key)
if (cfg.sehnd && !strcmp(key, XATTR_SECURITY_PREFIX "selinux"))
return true;
#endif
+
+ /* skip xattrs with unidentified "system." prefix */
+ if (!strncmp(key, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) {
+ if (!strcmp(key, XATTR_NAME_POSIX_ACL_ACCESS) ||
+ !strcmp(key, XATTR_NAME_POSIX_ACL_DEFAULT)) {
+ return false;
+ } else {
+ erofs_warn("skip unidentified xattr: %s", key);
+ return true;
+ }
+ }
+
return false;
}