* [PATCH v2] fs: hide names_cachep behind runtime access machinery
@ 2025-10-30 8:59 Mateusz Guzik
2025-10-30 10:34 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mateusz Guzik @ 2025-10-30 8:59 UTC (permalink / raw)
To: brauner
Cc: viro, jack, linux-kernel, linux-fsdevel, torvalds, pfalcato,
Mateusz Guzik
The var is used twice for every path lookup, while the cache is
initialized early and stays valid for the duration.
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
ACHTUNG WARNING POZOR UWAGA Блять: I did some testing and ifdef MODULE
seems to work, but perhaps someone with build-fu could chime in? I
verified with a hello world module that this fine, but maybe I missed a
case.
v2:
- ifdef on module usage -- the runtime thing does *not* work with modules
- patch up the section warn, thanks to Pedro for spotting what's up with
the problem
Linus cc'ed as he added the runtime thing + dcache usage in the first place.
The machinery does not support kernel modules and I have no interest in
spending time to extend it.
I tried to add a compilation time warn should someone compile a module
with it, but there is no shared header so I decided to forego doing it.
Should someone(tm) make this work for modules I'm not going to protest.
Absent that, vast majority of actual usage is coming from core kernel,
which *is* getting the new treatment and I don't think the ifdef is
particularly nasty.
fs/dcache.c | 1 +
include/asm-generic/vmlinux.lds.h | 3 ++-
include/linux/fs.h | 13 +++++++++++--
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index 035cccbc9276..786d09798313 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -3265,6 +3265,7 @@ void __init vfs_caches_init(void)
{
names_cachep = kmem_cache_create_usercopy("names_cache", PATH_MAX, 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, 0, PATH_MAX, NULL);
+ runtime_const_init(ptr, names_cachep);
dcache_init();
inode_init();
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index dcdbd962abd6..c7d85c80111c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -939,7 +939,8 @@
#define RUNTIME_CONST_VARIABLES \
RUNTIME_CONST(shift, d_hash_shift) \
- RUNTIME_CONST(ptr, dentry_hashtable)
+ RUNTIME_CONST(ptr, dentry_hashtable) \
+ RUNTIME_CONST(ptr, names_cachep)
/* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */
#define KUNIT_TABLE() \
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 68c4a59ec8fb..1095aff77a89 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2960,8 +2960,17 @@ extern void __init vfs_caches_init(void);
extern struct kmem_cache *names_cachep;
-#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL)
-#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
+/*
+ * XXX The runtime_const machinery does not support modules at the moment.
+ */
+#ifdef MODULE
+#define __names_cachep names_cachep
+#else
+#define __names_cachep runtime_const_ptr(names_cachep)
+#endif
+
+#define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
+#define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
extern struct super_block *blockdev_superblock;
static inline bool sb_is_blkdev_sb(struct super_block *sb)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fs: hide names_cachep behind runtime access machinery
2025-10-30 8:59 [PATCH v2] fs: hide names_cachep behind runtime access machinery Mateusz Guzik
@ 2025-10-30 10:34 ` kernel test robot
2025-10-30 10:34 ` kernel test robot
2025-10-30 10:34 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-10-30 10:34 UTC (permalink / raw)
To: Mateusz Guzik, brauner
Cc: oe-kbuild-all, viro, jack, linux-kernel, linux-fsdevel, torvalds,
pfalcato, Mateusz Guzik
Hi Mateusz,
kernel test robot noticed the following build warnings:
[auto build test WARNING on arnd-asm-generic/master]
[also build test WARNING on linus/master brauner-vfs/vfs.all linux/master v6.18-rc3 next-20251030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mateusz-Guzik/fs-hide-names_cachep-behind-runtime-access-machinery/20251030-170230
base: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link: https://lore.kernel.org/r/20251030085949.787504-1-mjguzik%40gmail.com
patch subject: [PATCH v2] fs: hide names_cachep behind runtime access machinery
config: nios2-allnoconfig (https://download.01.org/0day-ci/archive/20251030/202510301846.5be7UPQy-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251030/202510301846.5be7UPQy-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510301846.5be7UPQy-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/percpu.h:5,
from include/linux/radix-tree.h:16,
from include/linux/idr.h:15,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/energy_model.h:7,
from include/linux/device.h:16,
from drivers/base/firmware_loader/main.c:14:
drivers/base/firmware_loader/main.c: In function 'fw_get_filesystem_firmware':
include/linux/fs.h:2965:33: error: implicit declaration of function 'runtime_const_ptr' [-Werror=implicit-function-declaration]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~
include/linux/alloc_tag.h:239:16: note: in definition of macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
drivers/base/firmware_loader/main.c:509:16: note: in expansion of macro '__getname'
509 | path = __getname();
| ^~~~~~~~~
>> include/linux/fs.h:2965:33: warning: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:239:16: note: in definition of macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
drivers/base/firmware_loader/main.c:509:16: note: in expansion of macro '__getname'
509 | path = __getname();
| ^~~~~~~~~
In file included from include/linux/mm.h:34,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/nios2/include/uapi/asm/elf.h:24,
from arch/nios2/include/asm/elf.h:9,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/firmware_loader/main.c:14:
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from include/linux/percpu.h:5,
from include/linux/radix-tree.h:16,
from include/linux/idr.h:15,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/energy_model.h:7,
from include/linux/device.h:16,
from drivers/base/firmware_loader/main.c:14:
>> include/linux/fs.h:2965:33: warning: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:243:24: note: in definition of macro 'alloc_hooks_tag'
243 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
drivers/base/firmware_loader/main.c:509:16: note: in expansion of macro '__getname'
509 | path = __getname();
| ^~~~~~~~~
In file included from include/linux/mm.h:34,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/nios2/include/uapi/asm/elf.h:24,
from arch/nios2/include/asm/elf.h:9,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/firmware_loader/main.c:14:
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from include/linux/percpu.h:5,
from include/linux/radix-tree.h:16,
from include/linux/idr.h:15,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/energy_model.h:7,
from include/linux/device.h:16,
from drivers/base/firmware_loader/main.c:14:
>> include/linux/fs.h:2965:33: warning: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:246:24: note: in definition of macro 'alloc_hooks_tag'
246 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
drivers/base/firmware_loader/main.c:509:16: note: in expansion of macro '__getname'
509 | path = __getname();
| ^~~~~~~~~
In file included from include/linux/mm.h:34,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/nios2/include/uapi/asm/elf.h:24,
from arch/nios2/include/asm/elf.h:9,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/firmware_loader/main.c:14:
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from include/linux/huge_mm.h:7,
from include/linux/mm.h:1016,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/nios2/include/uapi/asm/elf.h:24,
from arch/nios2/include/asm/elf.h:9,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/firmware_loader/main.c:14:
>> include/linux/fs.h:2965:33: warning: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
drivers/base/firmware_loader/main.c:591:9: note: in expansion of macro '__putname'
591 | __putname(path);
| ^~~~~~~~~
In file included from include/linux/mm.h:34,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/nios2/include/uapi/asm/elf.h:24,
from arch/nios2/include/asm/elf.h:9,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from drivers/base/firmware_loader/main.c:14:
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
cc1: some warnings being treated as errors
vim +/kmem_cache_alloc_noprof +2965 include/linux/fs.h
2958
2959 /*
2960 * XXX The runtime_const machinery does not support modules at the moment.
2961 */
2962 #ifdef MODULE
2963 #define __names_cachep names_cachep
2964 #else
> 2965 #define __names_cachep runtime_const_ptr(names_cachep)
2966 #endif
2967
> 2968 #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
2969 #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
2970
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fs: hide names_cachep behind runtime access machinery
2025-10-30 8:59 [PATCH v2] fs: hide names_cachep behind runtime access machinery Mateusz Guzik
2025-10-30 10:34 ` kernel test robot
@ 2025-10-30 10:34 ` kernel test robot
2025-10-30 10:34 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-10-30 10:34 UTC (permalink / raw)
To: Mateusz Guzik, brauner
Cc: llvm, oe-kbuild-all, viro, jack, linux-kernel, linux-fsdevel,
torvalds, pfalcato, Mateusz Guzik
Hi Mateusz,
kernel test robot noticed the following build errors:
[auto build test ERROR on arnd-asm-generic/master]
[also build test ERROR on linus/master brauner-vfs/vfs.all linux/master v6.18-rc3 next-20251030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mateusz-Guzik/fs-hide-names_cachep-behind-runtime-access-machinery/20251030-170230
base: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link: https://lore.kernel.org/r/20251030085949.787504-1-mjguzik%40gmail.com
patch subject: [PATCH v2] fs: hide names_cachep behind runtime access machinery
config: loongarch-allnoconfig (https://download.01.org/0day-ci/archive/20251030/202510301845.m38jBkbI-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project d1c086e82af239b245fe8d7832f2753436634990)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251030/202510301845.m38jBkbI-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510301845.m38jBkbI-lkp@intel.com/
All errors (new ones prefixed by >>):
>> fs/namei.c:146:11: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
146 | result = __getname();
| ^
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
>> fs/namei.c:146:11: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
146 | result = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:239:9: note: expanded from macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
>> fs/namei.c:146:11: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
146 | result = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:243:10: note: expanded from macro 'alloc_hooks_tag'
243 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
>> fs/namei.c:146:11: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
146 | result = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:246:10: note: expanded from macro 'alloc_hooks_tag'
246 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
fs/namei.c:163:4: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
163 | __putname(result);
| ^
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
fs/namei.c:163:4: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
163 | __putname(result);
| ^~~~~~~~~~~~~~~~~
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:774:41: note: passing argument to parameter 's' here
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ^
fs/namei.c:169:4: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
169 | __putname(result);
| ^
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
fs/namei.c:169:4: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
169 | __putname(result);
| ^~~~~~~~~~~~~~~~~
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:774:41: note: passing argument to parameter 's' here
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ^
fs/namei.c:191:4: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
191 | __putname(kname);
| ^
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
fs/namei.c:191:4: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
191 | __putname(kname);
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:774:41: note: passing argument to parameter 's' here
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ^
fs/namei.c:197:4: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
197 | __putname(kname);
| ^
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
fs/namei.c:197:4: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
197 | __putname(kname);
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
--
>> fs/d_path.c:416:15: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
416 | char *page = __getname();
| ^
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
>> fs/d_path.c:416:15: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
416 | char *page = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:239:9: note: expanded from macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
>> fs/d_path.c:416:15: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
416 | char *page = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:243:10: note: expanded from macro 'alloc_hooks_tag'
243 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
>> fs/d_path.c:416:15: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
416 | char *page = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:246:10: note: expanded from macro 'alloc_hooks_tag'
246 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
fs/d_path.c:446:2: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
446 | __putname(page);
| ^
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
fs/d_path.c:446:2: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
446 | __putname(page);
| ^~~~~~~~~~~~~~~
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:774:41: note: passing argument to parameter 's' here
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ^
6 errors generated.
--
>> drivers/base/firmware_loader/main.c:509:9: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
509 | path = __getname();
| ^
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
>> drivers/base/firmware_loader/main.c:509:9: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
509 | path = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:239:9: note: expanded from macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
>> drivers/base/firmware_loader/main.c:509:9: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
509 | path = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:243:10: note: expanded from macro 'alloc_hooks_tag'
243 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
>> drivers/base/firmware_loader/main.c:509:9: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
509 | path = __getname();
| ^~~~~~~~~~~
include/linux/fs.h:2968:39: note: expanded from macro '__getname'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:739:69: note: expanded from macro 'kmem_cache_alloc'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/alloc_tag.h:253:31: note: expanded from macro 'alloc_hooks'
253 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ^~~~~~~~~
include/linux/alloc_tag.h:246:10: note: expanded from macro 'alloc_hooks_tag'
246 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:737:50: note: passing argument to parameter 'cachep' here
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ^
drivers/base/firmware_loader/main.c:591:2: error: call to undeclared function 'runtime_const_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
591 | __putname(path);
| ^
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^
drivers/base/firmware_loader/main.c:591:2: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct kmem_cache *' [-Wint-conversion]
591 | __putname(path);
| ^~~~~~~~~~~~~~~
include/linux/fs.h:2969:42: note: expanded from macro '__putname'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
include/linux/fs.h:2965:25: note: expanded from macro '__names_cachep'
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/slab.h:774:41: note: passing argument to parameter 's' here
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ^
6 errors generated.
vim +/runtime_const_ptr +146 fs/namei.c
611851010c7404 Mateusz Guzik 2025-03-13 134
51f39a1f0cea1c David Drysdale 2014-12-12 135 struct filename *
dff60734fc7606 Mateusz Guzik 2024-06-04 136 getname_flags(const char __user *filename, int flags)
91a27b2a756784 Jeff Layton 2012-10-10 137 {
94b5d2621aef59 Al Viro 2015-02-22 138 struct filename *result;
7950e3852ab868 Jeff Layton 2012-10-10 139 char *kname;
94b5d2621aef59 Al Viro 2015-02-22 140 int len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 141
7ac86265dc8f66 Jeff Layton 2012-10-10 142 result = audit_reusename(filename);
7ac86265dc8f66 Jeff Layton 2012-10-10 143 if (result)
7ac86265dc8f66 Jeff Layton 2012-10-10 144 return result;
7ac86265dc8f66 Jeff Layton 2012-10-10 145
7950e3852ab868 Jeff Layton 2012-10-10 @146 result = __getname();
3f9f0aa687d45c Linus Torvalds 2012-04-28 147 if (unlikely(!result))
4043cde8ecf7f7 Eric Paris 2012-01-03 148 return ERR_PTR(-ENOMEM);
^1da177e4c3f41 Linus Torvalds 2005-04-16 149
7950e3852ab868 Jeff Layton 2012-10-10 150 /*
7950e3852ab868 Jeff Layton 2012-10-10 151 * First, try to embed the struct filename inside the names_cache
7950e3852ab868 Jeff Layton 2012-10-10 152 * allocation
7950e3852ab868 Jeff Layton 2012-10-10 153 */
fd2f7cb5bcac58 Al Viro 2015-02-22 154 kname = (char *)result->iname;
91a27b2a756784 Jeff Layton 2012-10-10 155 result->name = kname;
7950e3852ab868 Jeff Layton 2012-10-10 156
94b5d2621aef59 Al Viro 2015-02-22 157 len = strncpy_from_user(kname, filename, EMBEDDED_NAME_MAX);
d4f50ea957cab6 Mateusz Guzik 2024-06-04 158 /*
d4f50ea957cab6 Mateusz Guzik 2024-06-04 159 * Handle both empty path and copy failure in one go.
d4f50ea957cab6 Mateusz Guzik 2024-06-04 160 */
d4f50ea957cab6 Mateusz Guzik 2024-06-04 161 if (unlikely(len <= 0)) {
91a27b2a756784 Jeff Layton 2012-10-10 162 if (unlikely(len < 0)) {
94b5d2621aef59 Al Viro 2015-02-22 163 __putname(result);
94b5d2621aef59 Al Viro 2015-02-22 164 return ERR_PTR(len);
91a27b2a756784 Jeff Layton 2012-10-10 165 }
3f9f0aa687d45c Linus Torvalds 2012-04-28 166
d4f50ea957cab6 Mateusz Guzik 2024-06-04 167 /* The empty path is special. */
d4f50ea957cab6 Mateusz Guzik 2024-06-04 168 if (!(flags & LOOKUP_EMPTY)) {
d4f50ea957cab6 Mateusz Guzik 2024-06-04 169 __putname(result);
d4f50ea957cab6 Mateusz Guzik 2024-06-04 170 return ERR_PTR(-ENOENT);
d4f50ea957cab6 Mateusz Guzik 2024-06-04 171 }
d4f50ea957cab6 Mateusz Guzik 2024-06-04 172 }
d4f50ea957cab6 Mateusz Guzik 2024-06-04 173
7950e3852ab868 Jeff Layton 2012-10-10 174 /*
7950e3852ab868 Jeff Layton 2012-10-10 175 * Uh-oh. We have a name that's approaching PATH_MAX. Allocate a
7950e3852ab868 Jeff Layton 2012-10-10 176 * separate struct filename so we can dedicate the entire
7950e3852ab868 Jeff Layton 2012-10-10 177 * names_cache allocation for the pathname, and re-do the copy from
7950e3852ab868 Jeff Layton 2012-10-10 178 * userland.
7950e3852ab868 Jeff Layton 2012-10-10 179 */
94b5d2621aef59 Al Viro 2015-02-22 180 if (unlikely(len == EMBEDDED_NAME_MAX)) {
fd2f7cb5bcac58 Al Viro 2015-02-22 181 const size_t size = offsetof(struct filename, iname[1]);
7950e3852ab868 Jeff Layton 2012-10-10 182 kname = (char *)result;
7950e3852ab868 Jeff Layton 2012-10-10 183
fd2f7cb5bcac58 Al Viro 2015-02-22 184 /*
fd2f7cb5bcac58 Al Viro 2015-02-22 185 * size is chosen that way we to guarantee that
fd2f7cb5bcac58 Al Viro 2015-02-22 186 * result->iname[0] is within the same object and that
fd2f7cb5bcac58 Al Viro 2015-02-22 187 * kname can't be equal to result->iname, no matter what.
fd2f7cb5bcac58 Al Viro 2015-02-22 188 */
fd2f7cb5bcac58 Al Viro 2015-02-22 189 result = kzalloc(size, GFP_KERNEL);
94b5d2621aef59 Al Viro 2015-02-22 190 if (unlikely(!result)) {
94b5d2621aef59 Al Viro 2015-02-22 191 __putname(kname);
94b5d2621aef59 Al Viro 2015-02-22 192 return ERR_PTR(-ENOMEM);
7950e3852ab868 Jeff Layton 2012-10-10 193 }
7950e3852ab868 Jeff Layton 2012-10-10 194 result->name = kname;
94b5d2621aef59 Al Viro 2015-02-22 195 len = strncpy_from_user(kname, filename, PATH_MAX);
94b5d2621aef59 Al Viro 2015-02-22 196 if (unlikely(len < 0)) {
94b5d2621aef59 Al Viro 2015-02-22 197 __putname(kname);
94b5d2621aef59 Al Viro 2015-02-22 198 kfree(result);
94b5d2621aef59 Al Viro 2015-02-22 199 return ERR_PTR(len);
94b5d2621aef59 Al Viro 2015-02-22 200 }
d4f50ea957cab6 Mateusz Guzik 2024-06-04 201 /* The empty path is special. */
d4f50ea957cab6 Mateusz Guzik 2024-06-04 202 if (unlikely(!len) && !(flags & LOOKUP_EMPTY)) {
d4f50ea957cab6 Mateusz Guzik 2024-06-04 203 __putname(kname);
d4f50ea957cab6 Mateusz Guzik 2024-06-04 204 kfree(result);
d4f50ea957cab6 Mateusz Guzik 2024-06-04 205 return ERR_PTR(-ENOENT);
d4f50ea957cab6 Mateusz Guzik 2024-06-04 206 }
94b5d2621aef59 Al Viro 2015-02-22 207 if (unlikely(len == PATH_MAX)) {
94b5d2621aef59 Al Viro 2015-02-22 208 __putname(kname);
94b5d2621aef59 Al Viro 2015-02-22 209 kfree(result);
94b5d2621aef59 Al Viro 2015-02-22 210 return ERR_PTR(-ENAMETOOLONG);
94b5d2621aef59 Al Viro 2015-02-22 211 }
7950e3852ab868 Jeff Layton 2012-10-10 212 }
b463d7fd118b98 Song Liu 2025-04-09 213 initname(result, filename);
^1da177e4c3f41 Linus Torvalds 2005-04-16 214 audit_getname(result);
^1da177e4c3f41 Linus Torvalds 2005-04-16 215 return result;
3f9f0aa687d45c Linus Torvalds 2012-04-28 216 }
3f9f0aa687d45c Linus Torvalds 2012-04-28 217
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] fs: hide names_cachep behind runtime access machinery
2025-10-30 8:59 [PATCH v2] fs: hide names_cachep behind runtime access machinery Mateusz Guzik
2025-10-30 10:34 ` kernel test robot
2025-10-30 10:34 ` kernel test robot
@ 2025-10-30 10:34 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-10-30 10:34 UTC (permalink / raw)
To: Mateusz Guzik, brauner
Cc: oe-kbuild-all, viro, jack, linux-kernel, linux-fsdevel, torvalds,
pfalcato, Mateusz Guzik
Hi Mateusz,
kernel test robot noticed the following build errors:
[auto build test ERROR on arnd-asm-generic/master]
[also build test ERROR on linus/master brauner-vfs/vfs.all linux/master v6.18-rc3 next-20251030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mateusz-Guzik/fs-hide-names_cachep-behind-runtime-access-machinery/20251030-170230
base: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link: https://lore.kernel.org/r/20251030085949.787504-1-mjguzik%40gmail.com
patch subject: [PATCH v2] fs: hide names_cachep behind runtime access machinery
config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20251030/202510301819.TojcyrUJ-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251030/202510301819.TojcyrUJ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510301819.TojcyrUJ-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/workqueue.h:9,
from include/linux/mm_types.h:19,
from include/linux/mmzone.h:22,
from include/linux/gfp.h:7,
from include/linux/slab.h:16,
from fs/namei.c:20:
fs/namei.c: In function 'getname_flags':
>> include/linux/fs.h:2965:33: error: implicit declaration of function 'runtime_const_ptr' [-Wimplicit-function-declaration]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~
include/linux/alloc_tag.h:239:16: note: in definition of macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
fs/namei.c:146:18: note: in expansion of macro '__getname'
146 | result = __getname();
| ^~~~~~~~~
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:239:16: note: in definition of macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
fs/namei.c:146:18: note: in expansion of macro '__getname'
146 | result = __getname();
| ^~~~~~~~~
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:243:24: note: in definition of macro 'alloc_hooks_tag'
243 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
fs/namei.c:146:18: note: in expansion of macro '__getname'
146 | result = __getname();
| ^~~~~~~~~
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:246:24: note: in definition of macro 'alloc_hooks_tag'
246 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
fs/namei.c:146:18: note: in expansion of macro '__getname'
146 | result = __getname();
| ^~~~~~~~~
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from fs/namei.c:22:
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:163:25: note: in expansion of macro '__putname'
163 | __putname(result);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:169:25: note: in expansion of macro '__putname'
169 | __putname(result);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:191:25: note: in expansion of macro '__putname'
191 | __putname(kname);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:197:25: note: in expansion of macro '__putname'
197 | __putname(kname);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:203:25: note: in expansion of macro '__putname'
203 | __putname(kname);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:208:25: note: in expansion of macro '__putname'
208 | __putname(kname);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
fs/namei.c: In function 'getname_kernel':
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:239:16: note: in definition of macro 'alloc_hooks_tag'
239 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
fs/namei.c:249:18: note: in expansion of macro '__getname'
249 | result = __getname();
| ^~~~~~~~~
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:243:24: note: in definition of macro 'alloc_hooks_tag'
243 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
fs/namei.c:249:18: note: in expansion of macro '__getname'
249 | result = __getname();
| ^~~~~~~~~
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_alloc_noprof' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/alloc_tag.h:246:24: note: in definition of macro 'alloc_hooks_tag'
246 | _res = _do_alloc; \
| ^~~~~~~~~
include/linux/slab.h:739:49: note: in expansion of macro 'alloc_hooks'
739 | #define kmem_cache_alloc(...) alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__))
| ^~~~~~~~~~~
include/linux/fs.h:2968:33: note: in expansion of macro 'kmem_cache_alloc'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~~~
include/linux/fs.h:2968:50: note: in expansion of macro '__names_cachep'
2968 | #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
| ^~~~~~~~~~~~~~
fs/namei.c:249:18: note: in expansion of macro '__getname'
249 | result = __getname();
| ^~~~~~~~~
include/linux/slab.h:737:50: note: expected 'struct kmem_cache *' but argument is of type 'int'
737 | void *kmem_cache_alloc_noprof(struct kmem_cache *cachep,
| ~~~~~~~~~~~~~~~~~~~^~~~~~
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:261:25: note: in expansion of macro '__putname'
261 | __putname(result);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:267:17: note: in expansion of macro '__putname'
267 | __putname(result);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
fs/namei.c: In function 'putname':
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:294:17: note: in expansion of macro '__putname'
294 | __putname(name->name);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
>> include/linux/fs.h:2965:33: error: passing argument 1 of 'kmem_cache_free' makes pointer from integer without a cast [-Wint-conversion]
2965 | #define __names_cachep runtime_const_ptr(names_cachep)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/fs.h:2969:49: note: in expansion of macro '__names_cachep'
2969 | #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
| ^~~~~~~~~~~~~~
fs/namei.c:297:17: note: in expansion of macro '__putname'
297 | __putname(name);
| ^~~~~~~~~
include/linux/slab.h:774:41: note: expected 'struct kmem_cache *' but argument is of type 'int'
774 | void kmem_cache_free(struct kmem_cache *s, void *objp);
| ~~~~~~~~~~~~~~~~~~~^
..
vim +/runtime_const_ptr +2965 include/linux/fs.h
2958
2959 /*
2960 * XXX The runtime_const machinery does not support modules at the moment.
2961 */
2962 #ifdef MODULE
2963 #define __names_cachep names_cachep
2964 #else
> 2965 #define __names_cachep runtime_const_ptr(names_cachep)
2966 #endif
2967
> 2968 #define __getname() kmem_cache_alloc(__names_cachep, GFP_KERNEL)
2969 #define __putname(name) kmem_cache_free(__names_cachep, (void *)(name))
2970
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-30 10:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 8:59 [PATCH v2] fs: hide names_cachep behind runtime access machinery Mateusz Guzik
2025-10-30 10:34 ` kernel test robot
2025-10-30 10:34 ` kernel test robot
2025-10-30 10:34 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).