linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <oliver.sang@intel.com>
To: Kan Liang <kan.liang@linux.intel.com>
Cc: <oe-lkp@lists.linux.dev>, <lkp@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	<linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <oliver.sang@intel.com>
Subject: [peterz-queue:perf/core] [perf/x86/rapl]  90942140bb: UBSAN:array-index-out-of-bounds_in_arch/x86/events/rapl.c
Date: Wed, 11 Sep 2024 16:32:13 +0800	[thread overview]
Message-ID: <202409111521.c7c6d56f-lkp@intel.com> (raw)



Hello,

kernel test robot noticed "UBSAN:array-index-out-of-bounds_in_arch/x86/events/rapl.c" on:

commit: 90942140bb6cc7e9a41d5927c7617ee522896f7a ("perf/x86/rapl: Move the pmu allocation out of CPU hotplug")
https://git.kernel.org/cgit/linux/kernel/git/peterz/queue.git perf/core

in testcase: boot

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

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


+-----------------------------------------------------------+------------+------------+
|                                                           | c206df6d69 | 90942140bb |
+-----------------------------------------------------------+------------+------------+
| UBSAN:array-index-out-of-bounds_in_arch/x86/events/rapl.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 <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202409111521.c7c6d56f-lkp@intel.com


[   22.115286][    T1] ------------[ cut here ]------------
[   22.115957][    T1] UBSAN: array-index-out-of-bounds in arch/x86/events/rapl.c:685:3
[   22.116970][    T1] index 0 is out of range for type 'struct rapl_pmu *[]'
[   22.117779][    T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc5-00045-g90942140bb6c #1
[   22.118811][    T1] Call Trace:
[   22.119182][    T1]  <TASK>
[ 22.121759][ T1] dump_stack_lvl (lib/dump_stack.c:121) 
[ 22.121759][ T1] __ubsan_handle_out_of_bounds (lib/ubsan.c:232 lib/ubsan.c:429) 
[ 22.121759][ T1] init_rapl_pmu (arch/x86/events/rapl.c:?) 
[ 22.121759][ T1] init_rapl_pmus (arch/x86/events/rapl.c:701) 
[ 22.121759][ T1] rapl_pmu_init (arch/x86/events/rapl.c:855) 
[ 22.121759][ T1] do_one_initcall (init/main.c:1267) 
[ 22.121759][ T1] ? pmu_check_apic (arch/x86/events/rapl.c:840) 
[ 22.121759][ T1] ? _raw_spin_unlock_irqrestore (arch/x86/include/asm/irqflags.h:42 arch/x86/include/asm/irqflags.h:97 arch/x86/include/asm/irqflags.h:155 include/linux/spinlock_api_smp.h:151 kernel/locking/spinlock.c:194) 
[ 22.121759][ T1] ? stack_depot_save_flags (lib/stackdepot.c:664) 
[ 22.121759][ T1] ? kasan_save_track (arch/x86/include/asm/current.h:49 mm/kasan/common.c:60 mm/kasan/common.c:69) 
[ 22.121759][ T1] ? kasan_save_track (mm/kasan/common.c:48 mm/kasan/common.c:68) 
[ 22.121759][ T1] ? __kasan_kmalloc (mm/kasan/common.c:391) 
[ 22.121759][ T1] ? __kmalloc_noprof (mm/slub.c:4159) 
[ 22.121759][ T1] ? do_initcalls (init/main.c:1339) 
[ 22.121759][ T1] ? kernel_init_freeable (init/main.c:1580) 
[ 22.121759][ T1] ? kernel_init (init/main.c:1469) 
[ 22.121759][ T1] ? asm_sysvec_apic_timer_interrupt (arch/x86/include/asm/idtentry.h:702) 
[ 22.121759][ T1] ? strlen (lib/string.c:402) 
[ 22.121759][ T1] ? parameq (kernel/params.c:99) 
[ 22.121759][ T1] ? parse_args (kernel/params.c:153) 
[ 22.121759][ T1] do_initcall_level (init/main.c:1328) 
[ 22.121759][ T1] do_initcalls (init/main.c:1342) 
[ 22.121759][ T1] kernel_init_freeable (init/main.c:1580) 
[ 22.121759][ T1] ? rest_init (init/main.c:1465) 
[ 22.121759][ T1] kernel_init (init/main.c:1469) 
[ 22.121759][ T1] ret_from_fork (arch/x86/kernel/process.c:153) 
[ 22.121759][ T1] ? rest_init (init/main.c:1465) 
[ 22.121759][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:257) 
[   22.121759][    T1]  </TASK>
[   22.145056][    T1] ---[ end trace ]---


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240911/202409111521.c7c6d56f-lkp@intel.com



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


             reply	other threads:[~2024-09-11  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  8:32 kernel test robot [this message]
2024-09-11  9:45 ` [peterz-queue:perf/core] [perf/x86/rapl] 90942140bb: UBSAN:array-index-out-of-bounds_in_arch/x86/events/rapl.c Peter Zijlstra
2024-09-11 14:35   ` Liang, Kan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202409111521.c7c6d56f-lkp@intel.com \
    --to=oliver.sang@intel.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).