Hi chench00,
FYI, the error/warning still remains.
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: 95bc69473a373c2e578d4fc39734e5811a03ead3
commit: 3ad98583441f7c8a2553e1e8d6340ed4397033e2 [1559/1559] crypto: tdm: Support dynamic protection for SCT and IDT by HYGON TDM
config: x86_64-randconfig-075-20241129 (https://download.01.org/0day-ci/archive/20241129/202411290729.4IacO2ee-lkp@…)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411290729.4IacO2ee-lkp@…)
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(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411290729.4IacO2ee-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/crypto/ccp/hygon/tdm-kernel-guard.c:15:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2242:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
drivers/crypto/ccp/hygon/tdm-kernel-guard.c:151:5: warning: no previous prototype for function 'tdm_service_run' [-Wmissing-prototypes]
151 | int tdm_service_run(struct tdm_security_enhance *data)
| ^
drivers/crypto/ccp/hygon/tdm-kernel-guard.c:151:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
151 | int tdm_service_run(struct tdm_security_enhance *data)
| ^
| static
drivers/crypto/ccp/hygon/tdm-kernel-guard.c:212:5: warning: no previous prototype for function 'tdm_service_exit' [-Wmissing-prototypes]
212 | int tdm_service_exit(struct tdm_security_enhance *data)
| ^
drivers/crypto/ccp/hygon/tdm-kernel-guard.c:212:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
212 | int tdm_service_exit(struct tdm_security_enhance *data)
| ^
| static
drivers/crypto/ccp/hygon/tdm-kernel-guard.c:243:15: warning: no previous prototype for function 'kprobe_symbol_address_byname' [-Wmissing-prototypes]
243 | unsigned long kprobe_symbol_address_byname(const char *name)
| ^
drivers/crypto/ccp/hygon/tdm-kernel-guard.c:243:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
243 | unsigned long kprobe_symbol_address_byname(const char *name)
| ^
| static
>> drivers/crypto/ccp/hygon/tdm-kernel-guard.c:308:23: error: use of undeclared identifier 'NR_syscalls'
308 | eh_objs[SCT].size = NR_syscalls * sizeof(char *);
| ^
4 warnings and 1 error generated.
vim +/NR_syscalls +308 drivers/crypto/ccp/hygon/tdm-kernel-guard.c
242
> 243 unsigned long kprobe_symbol_address_byname(const char *name)
244 {
245 int p_ret;
246 struct kprobe p_kprobe;
247 unsigned long addr = 0;
248
249 memset(&p_kprobe, 0, sizeof(p_kprobe));
250
251 p_kprobe.pre_handler = p_tmp_kprobe_handler;
252 p_kprobe.symbol_name = name;
253
254 p_ret = register_kprobe(&p_kprobe);
255 if (p_ret < 0) {
256 pr_err("register_kprobe error [%d] :(\n", p_ret);
257 return 0;
258 }
259
260 addr = (unsigned long)p_kprobe.addr;
261 unregister_kprobe(&p_kprobe);
262
263 return addr;
264 }
265 #endif
266
267 static int __init kernel_security_enhance_init(void)
268 {
269 int i = 0;
270 int ret = 0;
271 unsigned long *sct_addr;
272 struct desc_ptr idtr;
273 #if !IS_BUILTIN(CONFIG_TDM_KERNEL_GUARD)
274 unsigned long (*f_kallsyms_lookup_name)(const char *);
275
276 f_kallsyms_lookup_name = (unsigned long (*)(const char *))kprobe_symbol_address_byname(
277 "kallsyms_lookup_name");
278 if (!f_kallsyms_lookup_name) {
279 ret = -DYN_ERR_API;
280 pr_err("kprobe_symbol_address_byname failed!");
281 goto end;
282 }
283
284 sct_addr = (unsigned long *)f_kallsyms_lookup_name("sys_call_table");
285 #else
286
287 sct_addr = (unsigned long *)kallsyms_lookup_name("sys_call_table");
288 #endif
289 if (!sct_addr) {
290 ret = -DYN_ERR_API;
291 pr_err("kallsyms_lookup_name for sys_call_table failed!");
292 goto end;
293 }
294
295 asm("sidt %0":"=m"(idtr));
296
297 if (!psp_check_tdm_support())
298 return 0;
299
300 for (i = 0; i < MAX_OBJ; i++) {
301 memset(&eh_objs[i], 0, sizeof(eh_objs[i]));
302 eh_objs[i].context = CONTEXT_CHECK_MODNAME;
303 eh_objs[i].obj_name = obj_names[i];
304 }
305
306 if ((eh_obj == -1) || (eh_obj & (1 << SCT))) {
307 eh_objs[SCT].vaddr = (uint64_t)sct_addr;
> 308 eh_objs[SCT].size = NR_syscalls * sizeof(char *);
309 }
310 if ((eh_obj == -1) || (eh_obj & (1 << IDT))) {
311 eh_objs[IDT].vaddr = idtr.address;
312 eh_objs[IDT].size = idtr.size;
313 }
314
315 for (i = 0; i < MAX_OBJ; i++) {
316 if (eh_objs[i].vaddr)
317 tdm_service_run(&eh_objs[i]);
318 }
319
320 pr_info("Hygon TDM guard load successfully!\n");
321
322 end:
323 return ret;
324 }
325
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: 95bc69473a373c2e578d4fc39734e5811a03ead3
commit: 77313e84cc513055342c5e92ac8854e78bc15276 [1559/1559] virtcca feature : disable swiotlb for passthrough device
config: arm64-randconfig-004-20241129 (https://download.01.org/0day-ci/archive/20241129/202411290612.rtQtIYE0-lkp@…)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411290612.rtQtIYE0-lkp@…)
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(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411290612.rtQtIYE0-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> arch/arm64/kernel/virtcca_cvm_guest.c:139:6: warning: no previous prototype for 'enable_swiotlb_for_cvm_dev' [-Wmissing-prototypes]
139 | void enable_swiotlb_for_cvm_dev(struct device *dev, bool enable)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/enable_swiotlb_for_cvm_dev +139 arch/arm64/kernel/virtcca_cvm_guest.c
138
> 139 void enable_swiotlb_for_cvm_dev(struct device *dev, bool enable)
140 {
141 if (!is_virtcca_cvm_world())
142 return;
143
144 if (enable)
145 swiotlb_dev_init(dev);
146 else
147 dev->dma_io_tlb_mem = &io_tlb_no_swiotlb_mem;
148 }
149 EXPORT_SYMBOL_GPL(enable_swiotlb_for_cvm_dev);
150
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: 95bc69473a373c2e578d4fc39734e5811a03ead3
commit: 6f06e093b3708dcee5b7e4f0478e0206bc601da1 [1540/1540] sched/ebpf: Support task selection programmable
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20241129/202411290245.YQeCUdgI-lkp@…)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411290245.YQeCUdgI-lkp@…)
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(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411290245.YQeCUdgI-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from kernel/sched/build_utility.c:24:
In file included from include/linux/cpuset.h:17:
In file included from include/linux/mm.h:2247:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
In file included from kernel/sched/build_utility.c:113:
>> kernel/sched/bpf_sched.c:187:17: warning: no previous prototype for function 'bpf_sched_entity_is_task' [-Wmissing-prototypes]
187 | __bpf_kfunc int bpf_sched_entity_is_task(struct sched_entity *se)
| ^
kernel/sched/bpf_sched.c:187:13: note: declare 'static' if the function is not intended to be used outside of this translation unit
187 | __bpf_kfunc int bpf_sched_entity_is_task(struct sched_entity *se)
| ^
| static
>> kernel/sched/bpf_sched.c:195:33: warning: no previous prototype for function 'bpf_sched_entity_to_task' [-Wmissing-prototypes]
195 | __bpf_kfunc struct task_struct *bpf_sched_entity_to_task(struct sched_entity *se)
| ^
kernel/sched/bpf_sched.c:195:13: note: declare 'static' if the function is not intended to be used outside of this translation unit
195 | __bpf_kfunc struct task_struct *bpf_sched_entity_to_task(struct sched_entity *se)
| ^
| static
>> kernel/sched/bpf_sched.c:203:18: warning: no previous prototype for function 'bpf_sched_tag_of_entity' [-Wmissing-prototypes]
203 | __bpf_kfunc long bpf_sched_tag_of_entity(struct sched_entity *se)
| ^
kernel/sched/bpf_sched.c:203:13: note: declare 'static' if the function is not intended to be used outside of this translation unit
203 | __bpf_kfunc long bpf_sched_tag_of_entity(struct sched_entity *se)
| ^
| static
8 warnings generated.
vim +/bpf_sched_entity_is_task +187 kernel/sched/bpf_sched.c
186
> 187 __bpf_kfunc int bpf_sched_entity_is_task(struct sched_entity *se)
188 {
189 if (!se)
190 return -EINVAL;
191
192 return entity_is_task(se);
193 }
194
> 195 __bpf_kfunc struct task_struct *bpf_sched_entity_to_task(struct sched_entity *se)
196 {
197 if (se && entity_is_task(se))
198 return task_of(se);
199
200 return NULL;
201 }
202
> 203 __bpf_kfunc long bpf_sched_tag_of_entity(struct sched_entity *se)
204 {
205 if (!se)
206 return -EINVAL;
207
208 if (entity_is_task(se))
209 return task_of(se)->tag;
210
211 return group_cfs_rq(se)->tg->tag;
212 }
213
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi wangyuan,
FYI, the error/warning still remains.
tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS
head: b5504db0db8375a77340b5bb54c17cfb75d3c754
commit: 267bce716c1008522c3b8ddbeac8d3c65514e98f [1315/1315] crypto: hisilicon/qm - drop unnecessary IS_ENABLE(CONFIG_NUMA) check
config: arm64-randconfig-001-20241128 (https://download.01.org/0day-ci/archive/20241129/202411290122.mcPBFrhU-lkp@…)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241129/202411290122.mcPBFrhU-lkp@…)
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(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411290122.mcPBFrhU-lkp@intel.com/
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
In file included from include/linux/poll.h:12,
from include/linux/rtc.h:52,
from include/linux/efi.h:20,
from arch/arm64/include/asm/acpi.h:15,
from include/acpi/acpi_io.h:7,
from include/linux/acpi.h:47,
from drivers/crypto/hisilicon/qm.c:4:
In function '_copy_from_user',
inlined from 'copy_from_user' at include/linux/uaccess.h:144:7,
inlined from 'hisi_qm_uacce_ioctl' at drivers/crypto/hisilicon/qm.c:2280:7:
>> include/linux/uaccess.h:112:17: warning: 'qp_ctx' may be used uninitialized [-Wmaybe-uninitialized]
112 | kasan_check_write(to, n);
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/compiler.h:265,
from arch/arm64/include/asm/memory.h:24,
from arch/arm64/include/asm/page.h:52,
from drivers/crypto/hisilicon/qm.c:3:
include/linux/kasan-checks.h: In function 'hisi_qm_uacce_ioctl':
include/linux/kasan-checks.h:7:6: note: by argument 1 of type 'const volatile void *' to 'kasan_check_write' declared here
7 | void kasan_check_write(const volatile void *p, unsigned int size);
| ^~~~~~~~~~~~~~~~~
drivers/crypto/hisilicon/qm.c:2277:28: note: 'qp_ctx' declared here
2277 | struct hisi_qp_ctx qp_ctx;
| ^~~~~~
drivers/crypto/hisilicon/qm.c:3322: warning: Excess function parameter 'ce' description in 'qm_hw_error_init'
drivers/crypto/hisilicon/qm.c:3322: warning: Excess function parameter 'nfe' description in 'qm_hw_error_init'
drivers/crypto/hisilicon/qm.c:3322: warning: Excess function parameter 'fe' description in 'qm_hw_error_init'
drivers/crypto/hisilicon/qm.c:3322: warning: Excess function parameter 'msi' description in 'qm_hw_error_init'
vim +/qp_ctx +112 include/linux/uaccess.h
d597580d373774 Al Viro 2017-03-20 104
d597580d373774 Al Viro 2017-03-20 105 #ifdef INLINE_COPY_FROM_USER
d597580d373774 Al Viro 2017-03-20 106 static inline unsigned long
d597580d373774 Al Viro 2017-03-20 107 _copy_from_user(void *to, const void __user *from, unsigned long n)
d597580d373774 Al Viro 2017-03-20 108 {
d597580d373774 Al Viro 2017-03-20 109 unsigned long res = n;
9c5f6908de03a4 Al Viro 2017-06-29 110 might_fault();
4983cb67a383a7 Linus Torvalds 2019-02-14 111 if (likely(access_ok(from, n))) {
9c5f6908de03a4 Al Viro 2017-06-29 @112 kasan_check_write(to, n);
d597580d373774 Al Viro 2017-03-20 113 res = raw_copy_from_user(to, from, n);
9c5f6908de03a4 Al Viro 2017-06-29 114 }
d597580d373774 Al Viro 2017-03-20 115 if (unlikely(res))
d597580d373774 Al Viro 2017-03-20 116 memset(to + (n - res), 0, res);
d597580d373774 Al Viro 2017-03-20 117 return res;
d597580d373774 Al Viro 2017-03-20 118 }
d597580d373774 Al Viro 2017-03-20 119 #else
d597580d373774 Al Viro 2017-03-20 120 extern unsigned long
d597580d373774 Al Viro 2017-03-20 121 _copy_from_user(void *, const void __user *, unsigned long);
d597580d373774 Al Viro 2017-03-20 122 #endif
d597580d373774 Al Viro 2017-03-20 123
d597580d373774 Al Viro 2017-03-20 124 #ifdef INLINE_COPY_TO_USER
d597580d373774 Al Viro 2017-03-20 125 static inline unsigned long
d597580d373774 Al Viro 2017-03-20 126 _copy_to_user(void __user *to, const void *from, unsigned long n)
d597580d373774 Al Viro 2017-03-20 127 {
9c5f6908de03a4 Al Viro 2017-06-29 128 might_fault();
4983cb67a383a7 Linus Torvalds 2019-02-14 129 if (access_ok(to, n)) {
9c5f6908de03a4 Al Viro 2017-06-29 130 kasan_check_read(from, n);
d597580d373774 Al Viro 2017-03-20 131 n = raw_copy_to_user(to, from, n);
9c5f6908de03a4 Al Viro 2017-06-29 132 }
d597580d373774 Al Viro 2017-03-20 133 return n;
d597580d373774 Al Viro 2017-03-20 134 }
d597580d373774 Al Viro 2017-03-20 135 #else
d597580d373774 Al Viro 2017-03-20 136 extern unsigned long
d597580d373774 Al Viro 2017-03-20 137 _copy_to_user(void __user *, const void *, unsigned long);
d597580d373774 Al Viro 2017-03-20 138 #endif
d597580d373774 Al Viro 2017-03-20 139
d597580d373774 Al Viro 2017-03-20 140 static __always_inline unsigned long __must_check
d597580d373774 Al Viro 2017-03-20 141 copy_from_user(void *to, const void __user *from, unsigned long n)
d597580d373774 Al Viro 2017-03-20 142 {
b0377fedb65280 Al Viro 2017-06-29 143 if (likely(check_copy_size(to, n, false)))
d597580d373774 Al Viro 2017-03-20 @144 n = _copy_from_user(to, from, n);
d597580d373774 Al Viro 2017-03-20 145 return n;
d597580d373774 Al Viro 2017-03-20 146 }
d597580d373774 Al Viro 2017-03-20 147
:::::: The code at line 112 was first introduced by commit
:::::: 9c5f6908de03a4f52ba7364b11fcd6116225480c copy_{from,to}_user(): move kasan checks and might_fault() out-of-line
:::::: TO: Al Viro <viro(a)zeniv.linux.org.uk>
:::::: CC: Al Viro <viro(a)zeniv.linux.org.uk>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki