ClangBuiltLinux / linux

Linux kernel source tree
Other
242 stars 14 forks source link

clang-18/19 kernel fails to boot with KMSAN enabled (v6.11,x x86_64) #2054

Open ernsteiswuerfel opened 1 month ago

ernsteiswuerfel commented 1 month ago

With KMSAN enabled (no other sanitizers selected) kernel v6.11.1 doesn't boot at all. It gets stuck at UEFI bootscreen stating that it will load the kernel image, but after that nothing for several minutes... Without KMSAN the kernel boots just fine.

Machine is a Ryzen 5950X with 32 GB RAM and a Radeon RX 6700 XT. Same issue also with clang-18 and/or kernel v6.10.11.

Attached please find kernel dmesg (without KMSAN enabled) and the v6.11.1 kernel .config. dmesg_6111_zen3.txt config_6111_zen3-van.txt

ernsteiswuerfel commented 1 month ago

I reduced my kernel .config to check whether some of my .config options might interfere with it.

At one point I got it running but with KMSAN the system is unbearably slow. It took nearly 1 min to get from the UEFI screen to the dmesg listed on the console.

Nevertheless one step further. But I still can't boot into the system with KMSAN enabled as I now hit this page fault as soon as USB gets loaded:

[...]
BUG: unable to handle page fault for address: ffffd100004fd100
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 100010067 P4D 100010067 PUD 1000e3067 PMD 101b04067 PTE 0
Oops: Oops: 0000 [#1] SMP NOPTI
CPU: 11 UID: 0 PID: 525 Comm: kworker/11:2 Tainted: G    B   W          6.11.2-Zen3 #19
Tainted: [B]=BAD_PAGE, [W]=WARN
Hardware name: To Be Filled By O.E.M. B550M Pro4/B550M Pro4, BIOS P3.40 01/18/2024
Workqueue: usb_hub_wq hub_event
RIP: 0010:kmsan_internal_check_memory+0x115/0x550
Code: 48 89 44 24 20 45 31 ed 41 89 ee 44 89 fb eb 1a 41 89 df 44 89 f5 49 ff c5 41 89 ee 44 89 fb 4c 39 6c 24 40 0f 84 5d ff ff ff <43> 80 3c 2c 00 74 52 48 8b 44 24 38 4a 8d 3c 28 be 01 00 00 00 e8
RSP: 0018:ffffc900015ce3d0 EFLAGS: 00010046
RAX: 00000000ffffffff RBX: 00000000ffffffff RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffc900004fd100
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000ff0000000000 R12: ffffd100004fd100
R13: 0000000000000000 R14: 0000000000000000 R15: 00000000ffffffff
FS:  0000000000000000(0000) GS:ffff88883db00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffd100004fd100 CR3: 0000000137b2e000 CR4: 0000000000b50ef0
Call Trace:
 <TASK>
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? show_trace_log_lvl+0x35a/0x3c0
 ? usb_submit_urb+0x455/0x1ce0
 ? __die_body+0xbb/0x190
 ? page_fault_oops+0x9d0/0xcd0
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? is_prefetch+0x6a/0x790
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? spurious_kernel_fault+0x22/0x820
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? exc_page_fault+0x73/0x80
 ? asm_exc_page_fault+0x26/0x30
 ? kmsan_internal_check_memory+0x115/0x550
 usb_submit_urb+0x455/0x1ce0
 hid_submit_ctrl+0x8e0/0xcc0
 usbhid_restart_ctrl_queue+0x1e3/0x390
 usbhid_submit_report+0x6b5/0xf70
 ? hid_set_field+0x3a0/0x580
 usbhid_start+0x2d6b/0x3210
 ? hid_submit_ctrl+0xcc0/0xcc0
 hid_hw_start+0x60/0x180
 hid_generic_probe+0xa1/0xf0
 ? hid_generic_match+0xc0/0xc0
 hid_device_probe+0x3dd/0x7c0
 ? hid_uevent+0x4b0/0x4b0
 really_probe+0x649/0xe70
 __driver_probe_device+0x1ed/0x520
 ? __memcg_slab_free_hook+0x17b/0x470
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? srso_alias_return_thunk+0x5/0xfbef5
 driver_probe_device+0x68/0x810
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? parse_option_str+0x30/0x2b0
 ? hid_compare_device_paths+0x190/0x190
 __device_attach_driver+0x4c4/0x7d0
 bus_for_each_drv+0x47f/0x610
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? deferred_devs_show+0x2f0/0x2f0
 __device_attach+0x27e/0x4a0
 bus_probe_device+0x355/0x560
 device_add+0xaa1/0x1a40
 hid_add_device+0x4cb/0x670
 usbhid_probe+0x1191/0x1750
 ? hid_io_error+0x620/0x620
 usb_probe_interface+0x837/0x1120
 ? usb_register_driver+0x550/0x550
 really_probe+0x649/0xe70
 __driver_probe_device+0x1ed/0x520
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? usb_match_one_id+0x53a/0xa10
 driver_probe_device+0x68/0x810
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? parse_option_str+0x30/0x2b0
 ? usb_device_match+0x244/0x6f0
 __device_attach_driver+0x4c4/0x7d0
 bus_for_each_drv+0x47f/0x610
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? deferred_devs_show+0x2f0/0x2f0
 __device_attach+0x27e/0x4a0
 bus_probe_device+0x355/0x560
 device_add+0xaa1/0x1a40
 usb_set_configuration+0x2a60/0x31f0
 ? usb_choose_configuration+0x1030/0x1030
 usb_generic_driver_probe+0x9f/0x1f0
 ? usb_choose_configuration+0x1030/0x1030
 usb_probe_device+0x1a6/0x520
 ? is_usb_device_driver+0x70/0x70
 really_probe+0x649/0xe70
 __driver_probe_device+0x1ed/0x520
 driver_probe_device+0x68/0x810
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? parse_option_str+0x30/0x2b0
 ? usb_device_match+0x5d1/0x6f0
 __device_attach_driver+0x4c4/0x7d0
 bus_for_each_drv+0x47f/0x610
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? deferred_devs_show+0x2f0/0x2f0
 __device_attach+0x27e/0x4a0
 bus_probe_device+0x355/0x560
 device_add+0xaa1/0x1a40
 usb_new_device+0xf0f/0x17f0
 hub_event+0x3d60/0x5a10
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? __pm_runtime_idle+0x39/0x140
 ? usb_autopm_put_interface_async+0x6d/0xd0
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? led_work+0x510/0x510
 process_scheduled_works+0x853/0x1440
 worker_thread+0xd09/0x1210
 ? srso_alias_return_thunk+0x5/0xfbef5
 kthread+0x3f5/0x530
 ? pr_cont_work+0xb00/0xb00
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? kthread_blkcg+0xe0/0xe0
 ret_from_fork+0x57/0x80
 ? kthread_blkcg+0xe0/0xe0
 ret_from_fork_asm+0x11/0x20
 </TASK>
Modules linked in: xhci_pci ccp xhci_hcd sunrpc dm_mod pkcs8_key_parser efivarfs
CR2: ffffd100004fd100
---[ end trace 0000000000000000 ]---
RIP: 0010:kmsan_internal_check_memory+0x115/0x550
Code: 48 89 44 24 20 45 31 ed 41 89 ee 44 89 fb eb 1a 41 89 df 44 89 f5 49 ff c5 41 89 ee 44 89 fb 4c 39 6c 24 40 0f 84 5d ff ff ff <43> 80 3c 2c 00 74 52 48 8b 44 24 38 4a 8d 3c 28 be 01 00 00 00 e8
RSP: 0018:ffffc900015ce3d0 EFLAGS: 00010046
RAX: 00000000ffffffff RBX: 00000000ffffffff RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffc900004fd100
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000ff0000000000 R12: ffffd100004fd100
R13: 0000000000000000 R14: 0000000000000000 R15: 00000000ffffffff
FS:  0000000000000000(0000) GS:ffff88883db00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffd100004fd100 CR3: 0000000137b2e000 CR4: 0000000000b50ef0
note: kworker/11:2[525] exited with irqs disabled
usb 3-2.2: device descriptor read/64, error -32
usb 1-8: New USB device found, idVendor=26ce, idProduct=01a2, bcdDevice= 0.00
usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-8: Product: LED Controller
usb 1-8: Manufacturer: ASRock
usb 1-8: SerialNumber: A02019100900
usb 3-2.2: device descriptor read/64, error -32
input: ASRock LED Controller as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-8/1-8:1.0/0003:26CE:01A2.0002/input/input0
BUG: unable to handle page fault for address: ffffd100004fd180
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 100010067 P4D 100010067 PUD 1000e3067 PMD 101b04067 PTE 0
Oops: Oops: 0002 [#2] SMP NOPTI
CPU: 25 UID: 0 PID: 243 Comm: kworker/25:1 Tainted: G    B D W          6.11.2-Zen3 #19
Tainted: [B]=BAD_PAGE, [D]=DIE, [W]=WARN
Hardware name: To Be Filled By O.E.M. B550M Pro4/B550M Pro4, BIOS P3.40 01/18/2024
Workqueue: usb_hub_wq hub_event
RIP: 0010:memset_orig+0x33/0xb0
Code: b6 ce 48 b8 01 01 01 01 01 01 01 01 48 0f af c1 41 89 f9 41 83 e1 07 75 70 48 89 d1 48 c1 e9 06 74 35 0f 1f 44 00 00 48 ff c9 <48> 89 07 48 89 47 08 48 89 47 10 48 89 47 18 48 89 47 20 48 89 47
RSP: 0018:ffffc90000b46130 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000040 RSI: 0000000000000000 RDI: ffffd100004fd180
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: ffffd100004fd180 R11: ffffffff8395ec50 R12: ffffc900004fd180
R13: 0000000000000000 R14: ffffd100004fd180 R15: 0000000000000040
FS:  0000000000000000(0000) GS:ffff88883e900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffd100004fd180 CR3: 0000000137b2e000 CR4: 0000000000b50ef0
Call Trace:
 <TASK>
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? show_trace_log_lvl+0x35a/0x3c0
 ? kmsan_internal_set_shadow_origin+0x47/0x100
 ? __die_body+0xbb/0x190
 ? page_fault_oops+0x9d0/0xcd0
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? is_prefetch+0x6a/0x790
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? spurious_kernel_fault+0x22/0x820
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? exc_page_fault+0x73/0x80
 ? asm_exc_page_fault+0x26/0x30
 ? usbhid_stop+0xc50/0xc50
 ? memset_orig+0x33/0xb0
 kmsan_internal_set_shadow_origin+0x47/0x100
 usb_submit_urb+0x455/0x1ce0
 ? srso_alias_return_thunk+0x5/0xfbef5
 hid_start_in+0x18c/0x3f0
 usbhid_open+0x1d9/0x530
 ? usbhid_stop+0xc50/0xc50
 hid_hw_open+0xf3/0x210
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? hidinput_input_event+0x540/0x540
 input_open_device+0x2e1/0x4e0
 kbd_connect+0x135/0x290
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? kbd_match+0x190/0x190
 ? kbd_event+0x4aa0/0x4aa0
 input_register_device+0x1186/0x14e0
 hidinput_connect+0x3c5e/0x4960
 hid_connect+0x481/0x2ad0
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? srso_alias_return_thunk+0x5/0xfbef5
 hid_hw_start+0xcf/0x180
 hid_generic_probe+0xa1/0xf0
 ? hid_generic_match+0xc0/0xc0
 hid_device_probe+0x3dd/0x7c0
 ? hid_uevent+0x4b0/0x4b0
 really_probe+0x649/0xe70
 __driver_probe_device+0x1ed/0x520
 ? __memcg_slab_free_hook+0x17b/0x470
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? srso_alias_return_thunk+0x5/0xfbef5
 driver_probe_device+0x68/0x810
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? parse_option_str+0x30/0x2b0
 ? hid_compare_device_paths+0x190/0x190
 __device_attach_driver+0x4c4/0x7d0
 bus_for_each_drv+0x47f/0x610
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? deferred_devs_show+0x2f0/0x2f0
 __device_attach+0x27e/0x4a0
 bus_probe_device+0x355/0x560
 device_add+0xaa1/0x1a40
 hid_add_device+0x4cb/0x670
 usbhid_probe+0x1191/0x1750
 ? hid_io_error+0x620/0x620
 usb_probe_interface+0x837/0x1120
 ? usb_register_driver+0x550/0x550
 really_probe+0x649/0xe70
 __driver_probe_device+0x1ed/0x520
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? usb_match_one_id+0x53a/0xa10
 driver_probe_device+0x68/0x810
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? parse_option_str+0x30/0x2b0
 ? usb_device_match+0x244/0x6f0
 __device_attach_driver+0x4c4/0x7d0
 bus_for_each_drv+0x47f/0x610
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? deferred_devs_show+0x2f0/0x2f0
 __device_attach+0x27e/0x4a0
 bus_probe_device+0x355/0x560
 device_add+0xaa1/0x1a40
 usb_set_configuration+0x2a60/0x31f0
 ? usb_choose_configuration+0x1030/0x1030
 usb_generic_driver_probe+0x9f/0x1f0
 ? usb_choose_configuration+0x1030/0x1030
 usb_probe_device+0x1a6/0x520
 ? is_usb_device_driver+0x70/0x70
 really_probe+0x649/0xe70
 __driver_probe_device+0x1ed/0x520
 driver_probe_device+0x68/0x810
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? parse_option_str+0x30/0x2b0
 ? usb_device_match+0x5d1/0x6f0
 __device_attach_driver+0x4c4/0x7d0
 bus_for_each_drv+0x47f/0x610
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? deferred_devs_show+0x2f0/0x2f0
 __device_attach+0x27e/0x4a0
 bus_probe_device+0x355/0x560
 device_add+0xaa1/0x1a40
 usb_new_device+0xf0f/0x17f0
 hub_event+0x3d60/0x5a10
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? __pm_runtime_idle+0x39/0x140
 ? usb_autopm_put_interface_async+0x6d/0xd0
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? led_work+0x510/0x510
 process_scheduled_works+0x853/0x1440
 worker_thread+0xd09/0x1210
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? kmsan_get_metadata+0x14a/0x1d0
 kthread+0x3f5/0x530
 ? pr_cont_work+0xb00/0xb00
 ? srso_alias_return_thunk+0x5/0xfbef5
 ? kthread_blkcg+0xe0/0xe0
 ret_from_fork+0x57/0x80
 ? kthread_blkcg+0xe0/0xe0
 ret_from_fork_asm+0x11/0x20
 </TASK>
Modules linked in: xhci_pci ccp xhci_hcd sunrpc dm_mod pkcs8_key_parser efivarfs
CR2: ffffd100004fd180
---[ end trace 0000000000000000 ]---

dmesg (via netconsole) and kernel .config attached. config_6112_zen3-van.txt dmesg_6112_zen3_02.txt