[PATCH] D106056: [CVP] processSwitch: Remove default case when switch cover all possible values.
JunMa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 19 01:58:31 PDT 2021
junparser added a comment.
In D106056#2953104 <https://reviews.llvm.org/D106056#2953104>, @nathanchance wrote:
> I apologize that I do not have a ton of information (I am happy to provide whatever would be useful) but this patch causes an issue with booting an `x86_64_defconfig` Linux kernel build with ThinLTO (initially reported here: https://github.com/ClangBuiltLinux/linux/issues/1440).
>
> $ make -skj"$(nproc)" LLVM=1 LLVM_IAS=1 distclean defconfig
>
> $ scripts/config -e LTO_CLANG_THIN
>
> $ make -skj"$(nproc)" LLVM=1 LLVM_IAS=1 olddefconfig bzImage
>
> # from https://github.com/ClangBuiltLinux/boot-utils
> $ ../boot-utils/boot-qemu.sh -a x86_64 -k . -t 30s
> ...
> [ 3.999233] jump_label: Fatal kernel bug, unexpected op at __mod_timer.llvm.2796501342197355523+0x37f/0x4d0 [ffffffff8a90587f] (eb 02 eb 29 41 != 66 90 0f 1f 00)) size:2 type:1
> [ 4.000759] ------------[ cut here ]------------
> [ 4.001232] kernel BUG at arch/x86/kernel/jump_label.c:73!
> [ 4.001746] invalid opcode: 0000 [#1] SMP NOPTI
> [ 4.002174] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.14.0-rc6+ #1
> [ 4.002227] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
> [ 4.002227] Workqueue: events timer_update_keys
> [ 4.002227] RIP: 0010:__jump_label_patch+0x1ab/0x1c0
> [ 4.002227] Code: 5d 41 5e 41 5f 5d c3 48 c7 c7 2a 5f b0 8b 4c 89 fe 4c 89 fa 4c 89 f9 49 89 e8 45 89 e1 31 c0 41 56 e8 6c e8 0a 00 48 83 c4 08 <0f> 0b e8 be 54 c7 00 0f 0b 0f 0b 0f 0b 00 00 cc cc 00 00 cc cc 48
> [ 4.002227] RSP: 0018:ffff8e5440037d88 EFLAGS: 00010286
> [ 4.002227] RAX: 00000000000000a4 RBX: ffffffff8c20f964 RCX: 5fbdcdcfa2eb3900
> [ 4.002227] RDX: 0000000000000000 RSI: 0000000000000004 RDI: c0000000ffffbfff
> [ 4.002227] RBP: ffffffff8bbd5c11 R08: 0000000000000000 R09: ffff8c86de0a0000
> [ 4.002227] R10: 000000000000bffd R11: ffff8e5440037c40 R12: 0000000000000002
> [ 4.002227] R13: ffffffff8bbd5c11 R14: 0000000000000001 R15: ffffffff8a90587f
> [ 4.002227] FS: 0000000000000000(0000) GS:ffff8c86de200000(0000) knlGS:0000000000000000
> [ 4.002227] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 4.002227] CR2: 0000000000000000 CR3: 000000000e20c000 CR4: 0000000000350ff0
> [ 4.002227] Call Trace:
> [ 4.002227] ? __mod_timer.llvm.2796501342197355523+0x37f/0x4d0
> [ 4.002227] ? __mod_timer.llvm.2796501342197355523+0x38e/0x4d0
> [ 4.002227] ? __mod_timer.llvm.2796501342197355523+0x381/0x4d0
> [ 4.002227] ? arch_jump_label_transform_queue+0x26/0x60
> [ 4.002227] ? __jump_label_update+0x9c/0x150
> [ 4.002227] ? static_key_enable_cpuslocked+0x59/0x70
> [ 4.002227] ? timer_update_keys+0x59/0x70
> [ 4.002227] ? process_one_work+0x1cb/0x340
> [ 4.002227] ? worker_thread+0x25d/0x490
> [ 4.002227] ? kthread+0x1b6/0x1d0
> [ 4.002227] ? worker_clr_flags+0x40/0x40
> [ 4.002227] ? kthread_unuse_mm+0x80/0x80
> [ 4.002227] ? ret_from_fork+0x22/0x30
> [ 4.002227] Modules linked in:
> [ 4.018292] ---[ end trace 15930e2291b4abfa ]---
> [ 4.018735] RIP: 0010:__jump_label_patch+0x1ab/0x1c0
> [ 4.019229] Code: 5d 41 5e 41 5f 5d c3 48 c7 c7 2a 5f b0 8b 4c 89 fe 4c 89 fa 4c 89 f9 49 89 e8 45 89 e1 31 c0 41 56 e8 6c e8 0a 00 48 83 c4 08 <0f> 0b e8 be 54 c7 00 0f 0b 0f 0b 0f 0b 00 00 cc cc 00 00 cc cc 48
> [ 4.021000] RSP: 0018:ffff8e5440037d88 EFLAGS: 00010286
> [ 4.021481] RAX: 00000000000000a4 RBX: ffffffff8c20f964 RCX: 5fbdcdcfa2eb3900
> [ 4.022178] RDX: 0000000000000000 RSI: 0000000000000004 RDI: c0000000ffffbfff
> [ 4.022878] RBP: ffffffff8bbd5c11 R08: 0000000000000000 R09: ffff8c86de0a0000
> [ 4.023536] R10: 000000000000bffd R11: ffff8e5440037c40 R12: 0000000000000002
> [ 4.024255] R13: ffffffff8bbd5c11 R14: 0000000000000001 R15: ffffffff8a90587f
> [ 4.024957] FS: 0000000000000000(0000) GS:ffff8c86de200000(0000) knlGS:0000000000000000
> [ 4.025709] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 4.026307] CR2: 0000000000000000 CR3: 000000000e20c000 CR4: 0000000000350ff0
> ...
>
> I also see
>
> [ 0.108802] **********************************************************
> [ 0.109339] ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
> [ 0.109883] ** **
> [ 0.110470] ** This system shows unhashed kernel memory addresses **
> [ 0.111011] ** via the console, logs, and other interfaces. This **
> [ 0.111568] ** might reduce the security of your system. **
> [ 0.112145] ** **
> [ 0.112710] ** If you see this message and you are not debugging **
> [ 0.113281] ** the kernel, report this immediately to your system **
> [ 0.113841] ** administrator! **
> [ 0.114378] ** **
> [ 0.114890] ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
> [ 0.115439] **********************************************************
>
> in the boot logs but there are no command line or kernel changes that would cause this, leading me to believe there is something codegen-wise going wrong. I am more than happy to provide more information if need be.
>
> The `BUG()` in question can be viewed on line 73 here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/jump_label.c#n45
@samitolvanen, @nathanchance, Thanks for report this!
I have comfirmed the boot failure. And after some digging, it shows that LLVM trunk remove some default case in **cfg80211_edmg_chandef_valid**, which is correct tranformation. however, some operation in **tools/objtool/check.c** emit "vmlinux.o: warning: objtool: cfg80211_edmg_chandef_valid()+0x169: can't find jump dest instruction at .text.cfg80211_edmg_chandef_valid+0x17b", and the boot failed. When I ignore this function by hack code, there is no warning emit and boot is success. I also comment on https://github.com/ClangBuiltLinux/linux/issues/1440, FYI.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106056/new/
https://reviews.llvm.org/D106056
More information about the llvm-commits
mailing list