Re: [PATCH 3/4] Revert "of: reserved_mem: Use unflatten_devicetree APIs to scan reserved memory nodes"

From: kernel test robot
Date: Tue Jul 16 2024 - 04:07:01 EST




Hello,

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

commit: 50618d443add4eda4aa94c76fb56e72783c260ae ("[PATCH 3/4] Revert "of: reserved_mem: Use unflatten_devicetree APIs to scan reserved memory nodes"")
url: https://github.com/intel-lab-lkp/linux/commits/Oreoluwa-Babatunde/Revert-of-reserved_mem-Restructure-code-to-call-reserved-mem-init-functions-earlier/20240709-073454
base: https://git.kernel.org/cgit/linux/kernel/git/robh/linux.git for-next
patch subject: [PATCH 3/4] Revert "of: reserved_mem: Use unflatten_devicetree APIs to scan reserved memory nodes"

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)


+---------------------------------------------+------------+------------+
| | 20cf0f8c96 | 50618d443a |
+---------------------------------------------+------------+------------+
| boot_successes | 18 | 0 |
| boot_failures | 0 | 18 |
| BUG:kernel_NULL_pointer_dereference,address | 0 | 18 |
| Oops | 0 | 18 |
| RIP:fdt_ro_probe | 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/202407161521.ec4d9668-lkp@xxxxxxxxx


[ 0.082892][ T0] BUG: kernel NULL pointer dereference, address: 0000000000000004
[ 0.085157][ T0] #PF: supervisor read access in kernel mode
[ 0.086877][ T0] #PF: error_code(0x0000) - not-present page
[ 0.088532][ T0] PGD 0 P4D 0
[ 0.089466][ T0] Oops: Oops: 0000 [#1] PREEMPT
[ 0.090747][ T0] CPU: 0 PID: 0 Comm: swapper Tainted: G T 6.10.0-rc1-00046-g50618d443add #1
[ 0.093729][ T0] RIP: 0010:fdt_ro_probe_ (scripts/dtc/libfdt/libfdt.h:? lib/../scripts/dtc/libfdt/fdt.c:?)
[ 0.095168][ T0] Code: cc cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 b8 24 59 c7 5e b8 ed ff ff ff 40 f6 c7 07 74 07 31 c9 31 ff 31 d2 c3 <8b> 4f 04 8b 17 0f ca 81 fa 12 01 f2 2f 74 28 b8 f7 ff ff ff 81 fa
All code
========
0: cc int3
1: cc int3
2: cc int3
3: cc int3
4: cc int3
5: cc int3
6: cc int3
7: cc int3
8: 90 nop
9: 90 nop
a: 90 nop
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: b8 24 59 c7 5e mov $0x5ec75924,%eax
18: b8 ed ff ff ff mov $0xffffffed,%eax
1d: 40 f6 c7 07 test $0x7,%dil
21: 74 07 je 0x2a
23: 31 c9 xor %ecx,%ecx
25: 31 ff xor %edi,%edi
27: 31 d2 xor %edx,%edx
29: c3 ret
2a:* 8b 4f 04 mov 0x4(%rdi),%ecx <-- trapping instruction
2d: 8b 17 mov (%rdi),%edx
2f: 0f ca bswap %edx
31: 81 fa 12 01 f2 2f cmp $0x2ff20112,%edx
37: 74 28 je 0x61
39: b8 f7 ff ff ff mov $0xfffffff7,%eax
3e: 81 .byte 0x81
3f: fa cli

Code starting with the faulting instruction
===========================================
0: 8b 4f 04 mov 0x4(%rdi),%ecx
3: 8b 17 mov (%rdi),%edx
5: 0f ca bswap %edx
7: 81 fa 12 01 f2 2f cmp $0x2ff20112,%edx
d: 74 28 je 0x37
f: b8 f7 ff ff ff mov $0xfffffff7,%eax
14: 81 .byte 0x81
15: fa cli
[ 0.100859][ T0] RSP: 0000:ffffffff83e03e28 EFLAGS: 00010046
[ 0.102634][ T0] RAX: 00000000ffffffed RBX: 0000000000000000 RCX: 0000000000000000
[ 0.104925][ T0] RDX: 0000000000000010 RSI: ffffffff83ae68e5 RDI: 0000000000000000
[ 0.107172][ T0] RBP: 0000000000000010 R08: 0000000000000000 R09: 0000000000000000
[ 0.109427][ T0] R10: ffff88843fff2200 R11: 0000000000000000 R12: 0000000000000000
[ 0.111656][ T0] R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff83ae68e5
[ 0.113969][ T0] FS: 0000000000000000(0000) GS:ffffffff83eb3000(0000) knlGS:0000000000000000
[ 0.116389][ T0] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 0.118314][ T0] CR2: 0000000000000004 CR3: 0000000003ea3000 CR4: 00000000000000b0
[ 0.120569][ T0] Call Trace:
[ 0.121512][ T0] <TASK>
[ 0.122317][ T0] ? __die_body (arch/x86/kernel/dumpstack.c:421)
[ 0.123615][ T0] ? page_fault_oops (arch/x86/mm/fault.c:711)
[ 0.125110][ T0] ? console_flush_all (include/linux/rcupdate.h:? include/linux/srcu.h:232 kernel/printk/printk.c:286 kernel/printk/printk.c:2986)
[ 0.126609][ T0] ? exc_page_fault (arch/x86/include/asm/paravirt.h:687)
[ 0.127940][ T0] ? asm_exc_page_fault (arch/x86/include/asm/idtentry.h:623)
[ 0.129365][ T0] ? fdt_ro_probe_ (scripts/dtc/libfdt/libfdt.h:? lib/../scripts/dtc/libfdt/fdt.c:?)
[ 0.130637][ T0] ? fdt_path_offset_namelen (lib/../scripts/dtc/libfdt/fdt_ro.c:256)
[ 0.132233][ T0] ? fdt_scan_reserved_mem_reg_nodes (drivers/of/of_reserved_mem.c:?)
[ 0.134085][ T0] ? fdt_init_reserved_mem (drivers/of/of_reserved_mem.c:550)
[ 0.135650][ T0] ? x86_flattree_get_config (arch/x86/kernel/devicetree.c:313)
[ 0.137230][ T0] ? setup_arch (arch/x86/kernel/setup.c:1099)
[ 0.138552][ T0] ? start_kernel (init/main.c:481 init/main.c:927)
[ 0.139865][ T0] ? x86_64_start_reservations (??:?)
[ 0.141519][ T0] ? x86_64_start_kernel (??:?)
[ 0.142935][ T0] ? common_startup_64 (arch/x86/kernel/head_64.S:421)
[ 0.144349][ T0] </TASK>
[ 0.145232][ T0] Modules linked in:
[ 0.146391][ T0] CR2: 0000000000000004
[ 0.147628][ T0] ---[ end trace 0000000000000000 ]---
[ 0.149306][ T0] RIP: 0010:fdt_ro_probe_ (scripts/dtc/libfdt/libfdt.h:? lib/../scripts/dtc/libfdt/fdt.c:?)
[ 0.150885][ T0] Code: cc cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 b8 24 59 c7 5e b8 ed ff ff ff 40 f6 c7 07 74 07 31 c9 31 ff 31 d2 c3 <8b> 4f 04 8b 17 0f ca 81 fa 12 01 f2 2f 74 28 b8 f7 ff ff ff 81 fa
All code
========
0: cc int3
1: cc int3
2: cc int3
3: cc int3
4: cc int3
5: cc int3
6: cc int3
7: cc int3
8: 90 nop
9: 90 nop
a: 90 nop
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: b8 24 59 c7 5e mov $0x5ec75924,%eax
18: b8 ed ff ff ff mov $0xffffffed,%eax
1d: 40 f6 c7 07 test $0x7,%dil
21: 74 07 je 0x2a
23: 31 c9 xor %ecx,%ecx
25: 31 ff xor %edi,%edi
27: 31 d2 xor %edx,%edx
29: c3 ret
2a:* 8b 4f 04 mov 0x4(%rdi),%ecx <-- trapping instruction
2d: 8b 17 mov (%rdi),%edx
2f: 0f ca bswap %edx
31: 81 fa 12 01 f2 2f cmp $0x2ff20112,%edx
37: 74 28 je 0x61
39: b8 f7 ff ff ff mov $0xfffffff7,%eax
3e: 81 .byte 0x81
3f: fa cli

Code starting with the faulting instruction
===========================================
0: 8b 4f 04 mov 0x4(%rdi),%ecx
3: 8b 17 mov (%rdi),%edx
5: 0f ca bswap %edx
7: 81 fa 12 01 f2 2f cmp $0x2ff20112,%edx
d: 74 28 je 0x37
f: b8 f7 ff ff ff mov $0xfffffff7,%eax
14: 81 .byte 0x81
15: fa cli


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240716/202407161521.ec4d9668-lkp@xxxxxxxxx



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