[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202510301845.m38jBkbI-lkp@intel.com>
Date: Thu, 30 Oct 2025 18:34:56 +0800
From: kernel test robot <lkp@...el.com>
To: Mateusz Guzik <mjguzik@...il.com>, brauner@...nel.org
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
viro@...iv.linux.org.uk, jack@...e.cz, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, torvalds@...ux-foundation.org,
pfalcato@...e.de, Mateusz Guzik <mjguzik@...il.com>
Subject: Re: [PATCH v2] fs: hide names_cachep behind runtime access machinery
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@...el.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
Powered by blists - more mailing lists