[PATCH] fs, security: Fix file_set_fowner LSM hook inconsistencies
kernel test robot
lkp at intel.com
Tue Aug 13 01:42:28 UTC 2024
Hi Mickaël,
kernel test robot noticed the following build errors:
[auto build test ERROR on pcmoore-selinux/next]
[also build test ERROR on linus/master v6.11-rc3 next-20240812]
[cannot apply to brauner-vfs/vfs.all]
[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/Micka-l-Sala-n/fs-security-Fix-file_set_fowner-LSM-hook-inconsistencies/20240813-004648
base: https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git next
patch link: https://lore.kernel.org/r/20240812144936.1616628-1-mic%40digikod.net
patch subject: [PATCH] fs,security: Fix file_set_fowner LSM hook inconsistencies
config: x86_64-buildonly-randconfig-003-20240813 (https://download.01.org/0day-ci/archive/20240813/202408130900.y6a7Si8X-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240813/202408130900.y6a7Si8X-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408130900.y6a7Si8X-lkp@intel.com/
All errors (new ones prefixed by >>):
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:10: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:31: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
510 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~
include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
498 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~
include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
490 | if (!(condition)) \
| ^~~~~~~~~
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
510 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~
include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
498 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~
include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
490 | if (!(condition)) \
| ^~~~~~~~~
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
510 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~
include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
498 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~
include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
490 | if (!(condition)) \
| ^~~~~~~~~
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
510 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~
include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
498 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~
include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
490 | if (!(condition)) \
| ^~~~~~~~~
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
510 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~
include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
498 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~
include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
490 | if (!(condition)) \
| ^~~~~~~~~
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
50 | __READ_ONCE(x); \
| ^
include/asm-generic/rwonce.h:44:65: note: expanded from macro '__READ_ONCE'
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ^
include/linux/compiler_types.h:466:13: note: expanded from macro '__unqual_scalar_typeof'
466 | _Generic((x), \
| ^
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
50 | __READ_ONCE(x); \
| ^
include/asm-generic/rwonce.h:44:65: note: expanded from macro '__READ_ONCE'
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ^
include/linux/compiler_types.h:473:15: note: expanded from macro '__unqual_scalar_typeof'
473 | default: (x)))
| ^
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
50 | __READ_ONCE(x); \
| ^
include/asm-generic/rwonce.h:44:72: note: expanded from macro '__READ_ONCE'
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ^
>> fs/fcntl.c:250:14: error: cannot take the address of an rvalue of type 'const struct cred *'
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ^ ~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:747:28: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^ ~
include/linux/rcupdate.h:675:2: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^ ~
include/linux/rcupdate.h:527:43: note: expanded from macro '__rcu_dereference_check'
527 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
| ^ ~
include/asm-generic/rwonce.h:50:2: note: expanded from macro 'READ_ONCE'
50 | __READ_ONCE(x); \
| ^ ~
include/asm-generic/rwonce.h:44:70: note: expanded from macro '__READ_ONCE'
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ^ ~
>> fs/fcntl.c:250:43: error: member reference type 'struct fown_struct' is not a pointer; did you mean to use '.'?
250 | fown_cred = rcu_dereference(filp->f_owner->cred);
| ~~~~~~~~~~~~~^~
| .
include/linux/rcupdate.h:747:50: note: expanded from macro 'rcu_dereference'
747 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^
include/linux/rcupdate.h:675:27: note: expanded from macro 'rcu_dereference_check'
675 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
| ^
include/linux/rcupdate.h:530:12: note: expanded from macro '__rcu_dereference_check'
530 | ((typeof(*p) __force __kernel *)(local)); \
| ^
12 errors generated.
vim +250 fs/fcntl.c
239
240 #ifdef CONFIG_CHECKPOINT_RESTORE
241 static int f_getowner_uids(struct file *filp, unsigned long arg)
242 {
243 struct user_namespace *user_ns = current_user_ns();
244 uid_t __user *dst = (void __user *)arg;
245 const struct cred *fown_cred;
246 uid_t src[2];
247 int err;
248
249 rcu_read_lock();
> 250 fown_cred = rcu_dereference(filp->f_owner->cred);
251 src[0] = from_kuid(user_ns, fown_cred->uid);
252 src[1] = from_kuid(user_ns, fown_cred->euid);
253 rcu_read_unlock();
254
255 err = put_user(src[0], &dst[0]);
256 err |= put_user(src[1], &dst[1]);
257
258 return err;
259 }
260 #else
261 static int f_getowner_uids(struct file *filp, unsigned long arg)
262 {
263 return -EINVAL;
264 }
265 #endif
266
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the Linux-security-module-archive
mailing list