2024-04-24 08:08:54

by Oliver Sang

[permalink] [raw]
Subject: [linux-next:master] [kallsyms] 0bdad28369: UBSAN:array-index-out-of-bounds_in_kernel/kallsyms.c



Hello,

kernel test robot noticed "UBSAN:array-index-out-of-bounds_in_kernel/kallsyms.c" on:

commit: 0bdad28369fc5e93de39b5046228ed78e982fc71 ("kallsyms: Avoid weak references for kallsyms symbols")
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master

in testcase: boot

compiler: clang-17
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)


+------------------------------------------------------+------------+------------+
| | 82d460edc1 | 0bdad28369 |
+------------------------------------------------------+------------+------------+
| UBSAN:array-index-out-of-bounds_in_kernel/kallsyms.c | 0 | 12 |
+------------------------------------------------------+------------+------------+


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 <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]


[ 0.148342][ T0] ------------[ cut here ]------------
[ 0.148746][ T0] UBSAN: array-index-out-of-bounds in kernel/kallsyms.c:181:40
[ 0.149452][ T0] index 69197 is out of range for type 'const int[1]'
[ 0.149954][ T0] CPU: 0 PID: 0 Comm: swapper Not tainted 6.9.0-rc5-00005-g0bdad28369fc #1
[ 0.150594][ T0] Call Trace:
[ 0.150834][ T0] <TASK>
[ 0.151048][ T0] ? dump_stack_lvl (lib/dump_stack.c:? lib/dump_stack.c:114)
[ 0.151403][ T0] ? __ubsan_handle_out_of_bounds (lib/ubsan.c:232 lib/ubsan.c:429)
[ 0.151851][ T0] ? format_decode (lib/vsprintf.c:2592)
[ 0.152205][ T0] ? __cfi_kvm_guest_apic_eoi_write (arch/x86/kernel/kvm.c:337)
[ 0.152658][ T0] ? get_symbol_pos (kernel/kallsyms.c:?)
[ 0.153016][ T0] ? __cfi_kvm_guest_apic_eoi_write (arch/x86/kernel/kvm.c:337)
[ 0.153469][ T0] ? __cfi_kvm_guest_apic_eoi_write (arch/x86/kernel/kvm.c:337)
[ 0.153921][ T0] ? kallsyms_lookup_buildid (kernel/kallsyms.c:429)
[ 0.154333][ T0] ? __cfi_kvm_guest_apic_eoi_write (arch/x86/kernel/kvm.c:337)
[ 0.154785][ T0] ? __cfi_kvm_guest_apic_eoi_write (arch/x86/kernel/kvm.c:337)
[ 0.155236][ T0] ? __sprint_symbol (kernel/kallsyms.c:513)
[ 0.155597][ T0] ? symbol_string (lib/vsprintf.c:?)
[ 0.155958][ T0] ? pointer (lib/vsprintf.c:?)
[ 0.156273][ T0] ? vsnprintf (lib/vsprintf.c:2828)
[ 0.156602][ T0] ? vprintk_store (kernel/printk/printk.c:2228)
[ 0.156963][ T0] ? lock_release (kernel/locking/lockdep.c:?)
[ 0.157305][ T0] ? vprintk_emit (kernel/printk/printk.c:2329)
[ 0.157645][ T0] ? lock_release (kernel/locking/lockdep.c:?)
[ 0.157986][ T0] ? _printk (kernel/printk/printk.c:2376)
[ 0.158287][ T0] ? __cfi_kvm_guest_apic_eoi_write (arch/x86/kernel/kvm.c:337)
[ 0.158740][ T0] ? kvm_guest_init (arch/x86/kernel/kvm.c:?)
[ 0.159100][ T0] ? setup_arch (arch/x86/kernel/setup.c:1156)
[ 0.159435][ T0] ? start_kernel (init/main.c:906)
[ 0.159776][ T0] ? x86_64_start_reservations (??:?)
[ 0.160195][ T0] ? x86_64_start_kernel (??:?)
[ 0.160574][ T0] ? common_startup_64 (arch/x86/kernel/head_64.S:421)
[ 0.160956][ T0] </TASK>
[ 0.161176][ T0] ---[ end trace ]---


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240424/[email protected]



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki