ubsan: some error report during boot

From: Xishi Qiu
Date: Thu Jun 01 2017 - 08:50:46 EST


I got some error report during boot from ubsan,
kernel version is v4.12


[ 0.001000] ================================================================================
[ 0.001000] UBSAN: Undefined behaviour in arch/x86/kernel/apic/apic_flat_64.c:49:11
[ 0.001000] shift exponent 64 is too large for 64-bit type 'long unsigned int'
[ 0.001000] CPU: 64 PID: 0 Comm: swapper/64 Not tainted 4.12.0-rc3-327.44.58.18.x86_64+ #30
[ 0.001000] Hardware name: Huawei Technologies Co., Ltd. RH8100 V3/BC61PBIA, BIOS BLHSV028 11/11/2014
[ 0.001000] Call Trace:
[ 0.001000] dump_stack+0xbc/0x124
[ 0.001000] ? _atomic_dec_and_lock+0x14c/0x14c
[ 0.001000] ubsan_epilogue+0xd/0x4e
[ 0.001000] __ubsan_handle_shift_out_of_bounds+0x1fb/0x254
[ 0.001000] ? __ubsan_handle_load_invalid_value+0x15b/0x15b
[ 0.001000] ? set_pte_vaddr+0x5f/0x90
[ 0.001000] ? __native_set_fixmap+0x29/0x70
[ 0.001000] ? native_set_fixmap+0x60/0x70
[ 0.001000] ? cpu_init+0x537/0xac0
[ 0.001000] flat_init_apic_ldr+0xda/0x120
[ 0.001000] ? flat_init_apic_ldr+0xda/0x120
[ 0.001000] setup_local_APIC+0xef/0x810
[ 0.001000] apic_ap_setup+0xe/0x20
[ 0.001000] start_secondary+0x112/0x370
[ 0.001000] ? set_cpu_sibling_map+0x1970/0x1970
[ 0.001000] secondary_startup_64+0x9f/0x9f
[ 0.001000] ================================================================================



[ 47.146515] ================================================================================
[ 47.146519] UBSAN: Undefined behaviour in drivers/scsi/megaraid/megaraid_sas_fp.c:127:32
[ 47.146522] index 255 is out of range for type 'MR_LD_SPAN_MAP [1]'
[ 47.146529] CPU: 193 PID: 2435 Comm: systemd-udevd Not tainted 4.12.0-rc3-327.44.58.18.x86_64+ #30
[ 47.146531] Hardware name: Huawei Technologies Co., Ltd. RH8100 V3/BC61PBIA, BIOS BLHSV028 11/11/2014
[ 47.146534] Call Trace:
[ 47.146554] dump_stack+0xbc/0x124
[ 47.146559] ? _atomic_dec_and_lock+0x14c/0x14c
[ 47.146569] ubsan_epilogue+0xd/0x4e
[ 47.146574] __ubsan_handle_out_of_bounds+0x106/0x14d
[ 47.146578] ? __ubsan_handle_shift_out_of_bounds+0x254/0x254
[ 47.146586] ? usleep_range+0x110/0x110
[ 47.146596] ? memcpy+0x45/0x50
[ 47.146614] ? MR_PopulateDrvRaidMap+0x5d5/0x820 [megaraid_sas]
[ 47.146630] mr_update_load_balance_params+0x165/0x1c0 [megaraid_sas]
[ 47.146645] MR_ValidateMapInfo+0x218/0xc60 [megaraid_sas]
[ 47.146661] ? megasas_get_ctrl_info+0x3f1/0xdb0 [megaraid_sas]
[ 47.146668] ? __list_del_entry_valid+0x77/0x130
[ 47.146683] ? megasas_return_cmd+0xa5/0x3c0 [megaraid_sas]
[ 47.146697] ? megasas_get_cmd+0x2e0/0x2e0 [megaraid_sas]
[ 47.146712] ? wait_and_poll+0x7e/0x160 [megaraid_sas]
[ 47.146727] megasas_get_map_info+0x26d/0x380 [megaraid_sas]
[ 47.146742] megasas_init_adapter_fusion+0xaa4/0xe50 [megaraid_sas]
[ 47.146757] ? megasas_sync_map_info+0x430/0x430 [megaraid_sas]
[ 47.146761] ? kasan_kmalloc+0xad/0xe0
[ 47.146765] ? kmem_cache_alloc_trace+0x11a/0x320
[ 47.146779] ? megasas_init_fw+0x475/0x1b50 [megaraid_sas]
[ 47.146794] megasas_init_fw+0x500/0x1b50 [megaraid_sas]
[ 47.146808] ? megasas_resume+0x9c0/0x9c0 [megaraid_sas]
[ 47.146819] ? dma_generic_alloc_coherent+0x1a5/0x230
[ 47.146825] ? __init_waitqueue_head+0x9d/0x100
[ 47.146828] ? put_prev_task_stop+0x310/0x310
[ 47.146843] megasas_probe_one.part.19+0xfe2/0x2890 [megaraid_sas]
[ 47.146857] ? megasas_init_fw+0x1b50/0x1b50 [megaraid_sas]
[ 47.146862] ? save_stack_trace+0x1b/0x20
[ 47.146866] ? save_stack+0x46/0xd0
[ 47.146869] ? kasan_slab_free+0x70/0xc0
[ 47.146872] ? kfree+0xd8/0x350
[ 47.146878] ? acpi_pci_irq_enable+0x283/0x440
[ 47.146885] ? pcibios_enable_device+0x4a/0x60
[ 47.146890] ? do_pci_enable_device+0x164/0x240
[ 47.146893] ? pci_enable_device_flags+0x229/0x2d0
[ 47.146896] ? pci_enable_device_mem+0x13/0x20
[ 47.146909] ? megasas_probe_one+0x8e/0x150 [megaraid_sas]
[ 47.146912] ? local_pci_probe+0x95/0x120
[ 47.146915] ? pci_device_probe+0x2dc/0x3f0
[ 47.146921] ? driver_probe_device+0x36a/0x910
[ 47.146924] ? __driver_attach+0x139/0x180
[ 47.146927] ? bus_for_each_dev+0xfb/0x180
[ 47.146929] ? bus_add_driver+0x29b/0x4a0
...