security/selinux/ima.c:77:2: error: member reference type 'struct mutex' is not a pointer; did you mean to use '.'?
kernel test robot
build bottree: https://github.com/SELinuxProject/selinux-kernel pr/64 head: e619414065da38197e0148bb7b00d0a6997de5f1 commit: e619414065da38197e0148bb7b00d0a6997de5f1 [2/2] selinux: stop passing selinux_state pointers and their offspring config: hexagon-randconfig-r045-20230308 (https://download.01.org/0day-ci/archive/20230310/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/SELinuxProject/selinux-kernel/commit/e619414065da38197e0148bb7b00d0a6997de5f1
git remote add selinuxproject-selinux https://github.com/SELinuxProject/selinux-kernel
git fetch --no-tags selinuxproject-selinux pr/64
git checkout e619414065da38197e0148bb7b00d0a6997de5f1
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash security/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from security/selinux/ima.c:11:
In file included from include/linux/ima.h:13:
In file included from include/linux/kexec.h:19:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from security/selinux/ima.c:11:
In file included from include/linux/ima.h:13:
In file included from include/linux/kexec.h:19:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from security/selinux/ima.c:11:
In file included from include/linux/ima.h:13:
In file included from include/linux/kexec.h:19:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> security/selinux/ima.c:77:2: error: member reference type 'struct mutex' is not a pointer; did you mean to use '.'?
lockdep_assert_held(selinux_state.policy_mutex);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/lockdep.h:319:17: note: expanded from macro 'lockdep_assert_held'
lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/lockdep.h:286:52: note: expanded from macro 'lockdep_is_held'
#define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map)
^
include/linux/lockdep.h:313:32: note: expanded from macro 'lockdep_assert'
do { WARN_ON(debug_locks && !(cond)); } while (0)
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
include/asm-generic/bug.h:122:25: note: expanded from macro 'WARN_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
>> security/selinux/ima.c:77:2: error: cannot take the address of an rvalue of type 'struct lockdep_map'
lockdep_assert_held(selinux_state.policy_mutex);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/lockdep.h:319:17: note: expanded from macro 'lockdep_assert_held'
lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/lockdep.h:286:45: note: expanded from macro 'lockdep_is_held'
#define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map)
^
include/linux/lockdep.h:313:32: note: expanded from macro 'lockdep_assert'
do { WARN_ON(debug_locks && !(cond)); } while (0)
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
include/asm-generic/bug.h:122:25: note: expanded from macro 'WARN_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~6 warnings and 2 errors generated.
vim +77 security/selinux/ima.c
66
67 /*
68 * selinux_ima_measure_state_locked - Measure SELinux state and hash of policy
69 */
70 void selinux_ima_measure_state_locked(void)
71 {
72 char *state_str = NULL;
73 void *policy = NULL;
74 size_t policy_len;
75 int rc = 0;
76
> 77 lockdep_assert_held(selinux_state.policy_mutex);
78
79 state_str = selinux_ima_collect_state();
80 if (!state_str) {
81 pr_err("SELinux: %s: failed to read state.\n", __func__);
82 return;
83 }
84
85 ima_measure_critical_data("selinux", "selinux-state",
86 state_str, strlen(state_str), false,
87 NULL, 0);
88
89 kfree(state_str);
90
91 /*
92 * Measure SELinux policy only after initialization is completed.
93 */
94 if (!selinux_initialized())
95 return;
96
97 rc = security_read_state_kernel(&policy, &policy_len);
98 if (rc) {
99 pr_err("SELinux: %s: failed to read policy %d.\n", __func__, rc); 100 return;
101 }
102
103 ima_measure_critical_data("selinux", "selinux-policy-hash",
104 policy, policy_len, true,
105 NULL, 0);
106
107 vfree(policy);
108 }
109
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests