Re: [PATCH v1] Ftrace: make sched_wakeup can focus on the target process

From: kernel test robot
Date: Fri Oct 20 2023 - 03:59:26 EST




Hello,

kernel test robot noticed "BUG:kernel_NULL_pointer_dereference,address" on:

commit: e70b12f847f6d1b5db838c0eefa9d1d00c1591bd ("[PATCH v1] Ftrace: make sched_wakeup can focus on the target process")
url: https://github.com/intel-lab-lkp/linux/commits/Jinyu-Tang/Ftrace-make-sched_wakeup-can-focus-on-the-target-process/20231009-234127
base: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git 94f6f0550c625fab1f373bb86a6669b45e9748b3
patch link: https://lore.kernel.org/all/20231009153714.10743-1-tangjinyu@xxxxxxxxxxx/
patch subject: [PATCH v1] Ftrace: make sched_wakeup can focus on the target process

in testcase: boot

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

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


+---------------------------------------------+----------+------------+
| | v6.6-rc5 | e70b12f847 |
+---------------------------------------------+----------+------------+
| boot_successes | 33 | 0 |
| boot_failures | 0 | 18 |
| BUG:kernel_NULL_pointer_dereference,address | 0 | 18 |
| Oops:#[##] | 0 | 18 |
| EIP:__kmem_cache_alloc_lru | 0 | 18 |
| Kernel_panic-not_syncing:Fatal_exception | 0 | 18 |
+---------------------------------------------+----------+------------+


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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-lkp/202310201530.46065346-oliver.sang@xxxxxxxxx


[ 6.082261][ T1] BUG: kernel NULL pointer dereference, address: 0000000c
[ 6.083178][ T1] #PF: supervisor read access in kernel mode
[ 6.083178][ T1] #PF: error_code(0x0000) - not-present page
[ 6.083178][ T1] *pde = 00000000
[ 6.083178][ T1] Oops: 0000 [#1]
[ 6.083178][ T1] CPU: 0 PID: 1 Comm: swapper Not tainted 6.6.0-rc5-00001-ge70b12f847f6 #1
[ 6.083178][ T1] EIP: __kmem_cache_alloc_lru+0x1d/0x88
[ 6.083178][ T1] Code: 04 eb a7 31 db e9 a5 fe ff ff 8d 76 00 3e 8d 74 26 00 55 b9 ff ff ff ff 89 e5 83 ec 18 89 5d f4 89 c3 89 75 f8 89 7d fc 89 d7 <8b> 40 0c 89 04 24 89 d8 e8 ca fd ff ff 8b 55 04 89 c6 a1 e4 38 25
All code
========
0: 04 eb add $0xeb,%al
2: a7 cmpsl %es:(%rdi),%ds:(%rsi)
3: 31 db xor %ebx,%ebx
5: e9 a5 fe ff ff jmpq 0xfffffffffffffeaf
a: 8d 76 00 lea 0x0(%rsi),%esi
d: 3e 8d 74 26 00 lea %ds:0x0(%rsi,%riz,1),%esi
12: 55 push %rbp
13: b9 ff ff ff ff mov $0xffffffff,%ecx
18: 89 e5 mov %esp,%ebp
1a: 83 ec 18 sub $0x18,%esp
1d: 89 5d f4 mov %ebx,-0xc(%rbp)
20: 89 c3 mov %eax,%ebx
22: 89 75 f8 mov %esi,-0x8(%rbp)
25: 89 7d fc mov %edi,-0x4(%rbp)
28: 89 d7 mov %edx,%edi
2a:* 8b 40 0c mov 0xc(%rax),%eax <-- trapping instruction
2d: 89 04 24 mov %eax,(%rsp)
30: 89 d8 mov %ebx,%eax
32: e8 ca fd ff ff callq 0xfffffffffffffe01
37: 8b 55 04 mov 0x4(%rbp),%edx
3a: 89 c6 mov %eax,%esi
3c: a1 .byte 0xa1
3d: e4 38 in $0x38,%al
3f: 25 .byte 0x25

Code starting with the faulting instruction
===========================================
0: 8b 40 0c mov 0xc(%rax),%eax
3: 89 04 24 mov %eax,(%rsp)
6: 89 d8 mov %ebx,%eax
8: e8 ca fd ff ff callq 0xfffffffffffffdd7
d: 8b 55 04 mov 0x4(%rbp),%edx
10: 89 c6 mov %eax,%esi
12: a1 .byte 0xa1
13: e4 38 in $0x38,%al
15: 25 .byte 0x25
[ 6.083178][ T1] EAX: 00000000 EBX: 00000000 ECX: ffffffff EDX: 00000cc0
[ 6.083178][ T1] ESI: c3213800 EDI: 00000cc0 EBP: c3217d78 ESP: c3217d60
[ 6.083178][ T1] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 EFLAGS: 00010286
[ 6.083178][ T1] CR0: 80050033 CR2: 0000000c CR3: 02364000 CR4: 000406d0
[ 6.083178][ T1] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[ 6.083178][ T1] DR6: fffe0ff0 DR7: 00000400
[ 6.083178][ T1] Call Trace:
[ 6.083178][ T1] ? show_regs (arch/x86/kernel/dumpstack.c:479)
[ 6.083178][ T1] ? __die_body (arch/x86/kernel/dumpstack.c:421)
[ 6.083178][ T1] ? __die (arch/x86/kernel/dumpstack.c:435)
[ 6.083178][ T1] ? page_fault_oops (arch/x86/mm/fault.c:702)
[ 6.083178][ T1] ? kernelmode_fixup_or_oops+0x94/0xf4
[ 6.083178][ T1] ? __bad_area_nosemaphore+0x12f/0x1e4
[ 6.083178][ T1] ? bad_area_nosemaphore (arch/x86/mm/fault.c:867)
[ 6.083178][ T1] ? exc_page_fault (arch/x86/mm/fault.c:1472 arch/x86/mm/fault.c:1505 arch/x86/mm/fault.c:1561)
[ 6.083178][ T1] ? _raw_spin_unlock (kernel/locking/spinlock.c:187)
[ 6.083178][ T1] ? pvclock_clocksource_read_nowd (arch/x86/mm/fault.c:1518)
[ 6.083178][ T1] ? handle_exception (arch/x86/entry/entry_32.S:1049)
[ 6.083178][ T1] ? lookup_open (fs/namei.c:3121 fs/namei.c:3153 fs/namei.c:3456)
[ 6.083178][ T1] ? pvclock_clocksource_read_nowd (arch/x86/mm/fault.c:1518)
[ 6.083178][ T1] ? __kmem_cache_alloc_lru+0x1d/0x88
[ 6.083178][ T1] ? pvclock_clocksource_read_nowd (arch/x86/mm/fault.c:1518)
[ 6.083178][ T1] ? __kmem_cache_alloc_lru+0x1d/0x88
[ 6.083178][ T1] kmem_cache_alloc (mm/slub.c:3503)
[ 6.083178][ T1] tracefs_alloc_inode (fs/tracefs/inode.c:38)
[ 6.083178][ T1] alloc_inode (fs/inode.c:259)
[ 6.083178][ T1] new_inode_pseudo (fs/inode.c:1006)
[ 6.083178][ T1] new_inode (fs/inode.c:1031)
[ 6.083178][ T1] tracefs_get_inode (fs/tracefs/inode.c:153)
[ 6.083178][ T1] ? tracefs_start_creating (fs/tracefs/inode.c:470)
[ 6.083178][ T1] tracefs_create_file (fs/tracefs/inode.c:616)
[ 6.083178][ T1] ? set_tracer_flag (kernel/trace/trace.c:5441)
[ 6.083178][ T1] __wakeup_tracer_init (kernel/trace/trace_sched_wakeup.c:858)
[ 6.083178][ T1] wakeup_tracer_init (kernel/trace/trace_sched_wakeup.c:873)
[ 6.083178][ T1] trace_selftest_startup_wakeup (kernel/trace/trace_selftest.c:1216 (discriminator 1))
[ 6.083178][ T1] ? trace_selftest_ops (kernel/trace/trace_selftest.c:1155)
[ 6.083178][ T1] ? wait_for_completion (kernel/sched/completion.c:97 kernel/sched/completion.c:116 kernel/sched/completion.c:127 kernel/sched/completion.c:148)
[ 6.083178][ T1] run_tracer_selftest (kernel/trace/trace.c:2026)
[ 6.083178][ T1] register_tracer (kernel/trace/trace.c:2063 kernel/trace/trace.c:2187)
[ 6.083178][ T1] init_wakeup_tracer (kernel/trace/trace_sched_wakeup.c:985)
[ 6.083178][ T1] ? init_function_trace (kernel/trace/trace_sched_wakeup.c:982)
[ 6.083178][ T1] do_one_initcall (init/main.c:1232)
[ 6.083178][ T1] ? parameq (kernel/params.c:89 kernel/params.c:98)
[ 6.083178][ T1] ? parse_args (kernel/params.c:184)
[ 6.083178][ T1] ? kernel_init_freeable (init/main.c:1304 init/main.c:1329 init/main.c:1547)
[ 6.083178][ T1] kernel_init_freeable (init/main.c:1293 init/main.c:1310 init/main.c:1329 init/main.c:1547)
[ 6.083178][ T1] ? rdinit_setup (init/main.c:1278)
[ 6.083178][ T1] ? rest_init (init/main.c:1429)
[ 6.083178][ T1] kernel_init (init/main.c:1439)
[ 6.083178][ T1] ? schedule_tail (kernel/sched/core.c:5318)
[ 6.083178][ T1] ret_from_fork (arch/x86/kernel/process.c:153)
[ 6.083178][ T1] ? rest_init (init/main.c:1429)
[ 6.083178][ T1] ret_from_fork_asm (arch/x86/entry/entry_32.S:741)
[ 6.083178][ T1] entry_INT80_32 (arch/x86/entry/entry_32.S:947)
[ 6.083178][ T1] Modules linked in:
[ 6.083178][ T1] CR2: 000000000000000c
[ 6.083178][ T1] ---[ end trace 0000000000000000 ]---
[ 6.083178][ T1] EIP: __kmem_cache_alloc_lru+0x1d/0x88
[ 6.083178][ T1] Code: 04 eb a7 31 db e9 a5 fe ff ff 8d 76 00 3e 8d 74 26 00 55 b9 ff ff ff ff 89 e5 83 ec 18 89 5d f4 89 c3 89 75 f8 89 7d fc 89 d7 <8b> 40 0c 89 04 24 89 d8 e8 ca fd ff ff 8b 55 04 89 c6 a1 e4 38 25
All code
========
0: 04 eb add $0xeb,%al
2: a7 cmpsl %es:(%rdi),%ds:(%rsi)
3: 31 db xor %ebx,%ebx
5: e9 a5 fe ff ff jmpq 0xfffffffffffffeaf
a: 8d 76 00 lea 0x0(%rsi),%esi
d: 3e 8d 74 26 00 lea %ds:0x0(%rsi,%riz,1),%esi
12: 55 push %rbp
13: b9 ff ff ff ff mov $0xffffffff,%ecx
18: 89 e5 mov %esp,%ebp
1a: 83 ec 18 sub $0x18,%esp
1d: 89 5d f4 mov %ebx,-0xc(%rbp)
20: 89 c3 mov %eax,%ebx
22: 89 75 f8 mov %esi,-0x8(%rbp)
25: 89 7d fc mov %edi,-0x4(%rbp)
28: 89 d7 mov %edx,%edi
2a:* 8b 40 0c mov 0xc(%rax),%eax <-- trapping instruction
2d: 89 04 24 mov %eax,(%rsp)
30: 89 d8 mov %ebx,%eax
32: e8 ca fd ff ff callq 0xfffffffffffffe01
37: 8b 55 04 mov 0x4(%rbp),%edx
3a: 89 c6 mov %eax,%esi
3c: a1 .byte 0xa1
3d: e4 38 in $0x38,%al
3f: 25 .byte 0x25

Code starting with the faulting instruction
===========================================
0: 8b 40 0c mov 0xc(%rax),%eax
3: 89 04 24 mov %eax,(%rsp)
6: 89 d8 mov %ebx,%eax
8: e8 ca fd ff ff callq 0xfffffffffffffdd7
d: 8b 55 04 mov 0x4(%rbp),%edx
10: 89 c6 mov %eax,%esi
12: a1 .byte 0xa1
13: e4 38 in $0x38,%al
15: 25 .byte 0x25


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20231020/202310201530.46065346-oliver.sang@xxxxxxxxx



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