From 29e486e411947dd4c212d760ac5eee35ad6ba4fb Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 22 Apr 2025 23:11:31 -0400 Subject: [PATCH] All vfs methods now take a mnt_idmap instead of user_namespace arg. Similar to before when namespaces were added, they are now translated to a mnt_idmap, since v6.2-rc1-2-gabf08576afe3. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 8 ++++++++ kmod/src/kernelcompat.h | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 47aaf813..678295ba 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -278,6 +278,14 @@ ifneq (,$(shell grep 'int ..mknod. .struct user_namespace' include/linux/fs.h)) ccflags-y += -DKC_VFS_METHOD_USER_NAMESPACE_ARG endif +# +# v6.2-rc1-2-gabf08576afe3 +# +# fs: vfs methods use struct mnt_idmap instead of struct user_namespace +ifneq (,$(shell grep 'int vfs_mknod.struct mnt_idmap' include/linux/fs.h)) +ccflags-y += -DKC_VFS_METHOD_MNT_IDMAP_ARG +endif + # # v5.17-rc2-21-g07888c665b40 # diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 43e8c91c..5564a12a 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -263,6 +263,11 @@ typedef unsigned int blk_opf_t; #define kc__vmalloc __vmalloc #endif +#ifdef KC_VFS_METHOD_MNT_IDMAP_ARG +#define KC_VFS_NS_DEF struct mnt_idmap *mnt_idmap, +#define KC_VFS_NS mnt_idmap, +#define KC_VFS_INIT_NS &nop_mnt_idmap, +#else #ifdef KC_VFS_METHOD_USER_NAMESPACE_ARG #define KC_VFS_NS_DEF struct user_namespace *mnt_user_ns, #define KC_VFS_NS mnt_user_ns, @@ -272,6 +277,7 @@ typedef unsigned int blk_opf_t; #define KC_VFS_NS #define KC_VFS_INIT_NS #endif +#endif /* KC_VFS_METHOD_MNT_IDMAP_ARG */ #ifdef KC_BIO_ALLOC_DEV_OPF_ARGS #define kc_bio_alloc bio_alloc