UBSAN: invalid-load in amdgpu_dm.c for type '_Bool'
Brief summary of the problem:
I compiled my kernel with UBSAN enabled (UBSAN
, UBSAN_BOUNDS
, UBSAN_SHIFT
, UBSAN_DIV_ZERO
, UBSAN_BOOL
, UBSAN_ENUM
, UBSAN_SANITIZE_ALL
) and upon booting with that kernel, I get a warning:
================================================================================
UBSAN: invalid-load in drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5860:84
load of value 128 is not a valid value for type '_Bool'
CPU: 2 PID: 1 Comm: swapper/0 Tainted: G T 5.14.17-gentoo-c #3
Hardware name: LENOVO 20UDS0DK00/20UDS0DK00, BIOS R1BET65W(1.34 ) 06/17/2021
Call Trace:
dump_stack_lvl+0x34/0x44
ubsan_epilogue+0x5/0x40
__ubsan_handle_load_invalid_value.cold+0x43/0x48
create_stream_for_sink.cold+0x3a/0x7d
create_validate_stream_for_sink+0x50/0x140
amdgpu_dm_connector_mode_valid+0x4a/0x180
drm_connector_mode_valid+0x30/0x50
drm_helper_probe_single_connector_modes+0x3af/0x870
drm_client_modeset_probe+0x22c/0x5d0
? drm_file_alloc+0x1ac/0x250
__drm_fb_helper_initial_config_and_unlock+0x2b/0xc0
amdgpu_fbdev_init+0xc3/0x100
amdgpu_device_init.cold+0x2ed/0x74e
amdgpu_driver_load_kms+0x45/0x260
amdgpu_pci_probe+0xda/0x160
pci_device_probe+0x9e/0x110
really_probe.part.0+0xb3/0x290
__driver_probe_device+0xa9/0x150
driver_probe_device+0x19/0x100
__driver_attach+0xbc/0x1a0
? __device_attach_driver+0x120/0x120
bus_for_each_dev+0x73/0xb0
bus_add_driver+0x106/0x1c0
driver_register+0x8a/0xe0
? drm_sched_fence_slab_init+0x80/0x80
do_one_initcall+0x3f/0x1c0
do_initcalls+0x1d3/0x22f
kernel_init_freeable+0x159/0x1bc
? rest_init+0xe0/0xe0
kernel_init+0x12/0x130
? rest_init+0xe0/0xe0
ret_from_fork+0x22/0x30
================================================================================
In the end the boot fails, as I don't reach my desktop environment.
Hardware description:
- CPU: Ryzen 4750U
- GPU: Advanced Micro Devices, Inc. [AMD/ATI] Renoir [1002:1636] (rev d1)
- System Memory: 48 GiB
- Display(s): 2 connected, 1 active
- Type of Display Connection: laptop, external DP via USB-C dock
System information:
- Distro name and Version: Gentoo
- Kernel version: 5.14.17
- Custom kernel: gentoo patches (very light, almost upstream)
- AMD official driver version: 19.1.0
How to reproduce the issue:
- Activate UBSAN in the kernel-config (
UBSAN
,UBSAN_BOUNDS
,UBSAN_SHIFT
,UBSAN_DIV_ZERO
,UBSAN_BOOL
,UBSAN_ENUM
,UBSAN_SANITIZE_ALL
) - Recompile kernel
- Install modules
- Install kernel to /boot
- boot with UBSAN-enabled kernel
Other reports
I've seen one possibly related bug report on the kernel Bugzilla.