From 592e3d471fb97e1e6af68caf5fb5271d5db563cf Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 10 Jul 2023 18:31:55 -0400 Subject: [PATCH] Use `.prefix` for POSIX acl instead of `.name`. New kernels expect to do a partial match when a .prefix is used here, and provide a .name member in case matching should look at the whole string. This is what we want. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ++++++++++ kmod/src/xattr.c | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 55c5a256..352f2671 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -248,3 +248,13 @@ endif ifneq (,$(shell grep 'size_t.*ki_left;' include/linux/aio.h)) ccflags-y += -DKC_LINUX_AIO_KI_LEFT=1 endif + +# +# v4.4-rc4-4-g98e9cb5711c6 +# +# Introduces a new xattr_handler .name member that can be used to match the +# entire field, instead of just a prefix. For these kernels, we must use +# the new .name field instead. +ifneq (,$(shell grep 'static inline const char .xattr_prefix' include/linux/xattr.h)) +ccflags-y += -DKC_XATTR_HANDLER_NAME=1 +endif diff --git a/kmod/src/xattr.c b/kmod/src/xattr.c index da736ef5..fa418b8c 100644 --- a/kmod/src/xattr.c +++ b/kmod/src/xattr.c @@ -925,14 +925,22 @@ static const struct xattr_handler scoutfs_xattr_security_handler = { }; static const struct xattr_handler scoutfs_xattr_acl_access_handler = { +#ifdef KC_XATTR_HANDLER_NAME + .name = XATTR_NAME_POSIX_ACL_ACCESS, +#else .prefix = XATTR_NAME_POSIX_ACL_ACCESS, +#endif .flags = ACL_TYPE_ACCESS, .get = scoutfs_acl_get_xattr, .set = scoutfs_acl_set_xattr, }; static const struct xattr_handler scoutfs_xattr_acl_default_handler = { +#ifdef KC_XATTR_HANDLER_NAME + .name = XATTR_NAME_POSIX_ACL_DEFAULT, +#else .prefix = XATTR_NAME_POSIX_ACL_DEFAULT, +#endif .flags = ACL_TYPE_DEFAULT, .get = scoutfs_acl_get_xattr, .set = scoutfs_acl_set_xattr,