Re: [PATCH] x86/alternatives: gracefully s kip unrecognized indirect call instructions

"H. Peter Anvin" <[email protected]>
Newsgroups org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On August 12, 2026 10:14:41 AM PDT, "李则良" <[email protected]> wrote:
>>
>> I don't think we want to cater for this. But what actual instruction
>> sequences is it emitting?
>
>This is the scene that triggers the bug, which can be perfectly
>reproduced when KCFLAGS=-O1.
>
>[    0.111827] SMP alternatives: ALT_FLAG_DIRECT_CALL set for
>unrecognized indirect call
>[    0.112083] ------------[ cut here ]------------
>[    0.112417] kernel BUG at arch/x86/kernel/alternative.c:558!
>[    0.113080] Oops: invalid opcode: 0000 [#1] SMP NOPTI
>[    0.113424] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted
>7.2.0-rc7-00016-g3d6d817622b0-dirty #2 PREEMPT(lazy)
>[    0.114077] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009),
>BIOS 1.17.0-debian-1.17.0-1ubuntu1 04/01/2014
>[    0.114077] RIP: 0010:apply_alternatives+0x3a6/0x540
>[    0.114077] Code: 8d 04 80 89 95 d1 fe ff ff e9 dd fe ff ff 48 c7
>c7 f8 88 9d 82 e8 ea 94 0d 00 90 0f 0b 48 c7 c7 50 89 9d 82 e8 db 94
>0d 00 90 <0f> 0b 80 7d ce 00 75 0d 41 80 7e 0d 00 0f 84 14 ff ff ff eb
>62 48
>[    0.114077] RSP: 0000:ffffffff82c03d60 EFLAGS: 00010246
>[    0.114077] RAX: 0000000000000049 RBX: ffffffff831dae1c RCX: 0000000000000003
>[    0.114077] RDX: 0000000000000000 RSI: ffffffff82d3cd08 RDI: 0000000000000001
>[    0.114077] RBP: ffffffff82c03ea8 R08: 0000000000000000 R09: 205d373238313131
>[    0.114077] R10: 7265746c6120504d R11: 65746c6120504d53 R12: ffffffff831e116c
>[    0.114077] R13: ffffffff82ee2880 R14: ffffffff831dae0e R15: ffffffff831e1f58
>[    0.114077] FS:  0000000000000000(0000) GS:ffff8882f4a18000(0000)
>knlGS:0000000000000000
>[    0.114077] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>[    0.114077] CR2: ffff88827ffff000 CR3: 0000000002c30001 CR4: 0000000000770ef0
>[    0.114077] PKRU: 55555554
>[    0.114077] Call Trace:
>[    0.114077]  <TASK>
>[    0.114077]  ? insn_get_sib+0x21/0x80
>[    0.114077]  ? early_fixup_exception+0x85/0xa0
>[    0.114077]  alternative_instructions+0x76/0x110
>[    0.114077]  arch_cpu_finalize_init+0x113/0x170
>[    0.114077]  start_kernel+0x794/0x820
>[    0.114077]  x86_64_start_reservations+0x28/0x30
>[    0.114077]  x86_64_start_kernel+0xdc/0xe0
>[    0.114077]  common_startup_64+0x13e/0x158
>[    0.114077] RIP: 1f0f:0x2e66000000000084
>[    0.114077] Code: Unable to access opcode bytes at 0x2e6600000000005a.
>[    0.114077] RSP: 0000:00841f0f2e660000 EFLAGS: 841f0f2e66 ORIG_RAX:
>1f0f2e6600000000
>[    0.114077] RAX: 1f0f2e6600000000 RBX: 1f0f2e6600000000 RCX: 2e66000000000084
>[    0.114077] RDX: 0000000000841f0f RSI: 000000841f0f2e66 RDI: 00841f0f2e660000
>[    0.114077] RBP: 00841f0f2e660000 R08: 00841f0f2e660000 R09: 000000841f0f2e66
>[    0.114077] R10: 0000000000841f0f R11: 2e66000000000084 R12: 000000841f0f2e66
>[    0.114077] R13: 0000000000841f0f R14: 2e66000000000084 R15: 1f0f2e6600000000
>[    0.114077]  </TASK>
>[    0.114077] Modules linked in:
>[    0.114078] ---[ end trace 0000000000000000 ]---
>[    0.114405] RIP: 0010:apply_alternatives+0x3a6/0x540
>[    0.115078] Code: 8d 04 80 89 95 d1 fe ff ff e9 dd fe ff ff 48 c7
>c7 f8 88 9d 82 e8 ea 94 0d 00 90 0f 0b 48 c7 c7 50 89 9d 82 e8 db 94
>0d 00 90 <0f> 0b 80 7d ce 00 75 0d 41 80 7e 0d 00 0f 84 14 ff ff ff eb
>62 48
>[    0.116078] RSP: 0000:ffffffff82c03d60 EFLAGS: 00010246
>[    0.116456] RAX: 0000000000000049 RBX: ffffffff831dae1c RCX: 0000000000000003
>[    0.117077] RDX: 0000000000000000 RSI: ffffffff82d3cd08 RDI: 0000000000000001
>[    0.117589] RBP: ffffffff82c03ea8 R08: 0000000000000000 R09: 205d373238313131
>[    0.118077] R10: 7265746c6120504d R11: 65746c6120504d53 R12: ffffffff831e116c
>[    0.118585] R13: ffffffff82ee2880 R14: ffffffff831dae0e R15: ffffffff831e1f58
>[    0.119077] FS:  0000000000000000(0000) GS:ffff8882f4a18000(0000)
>knlGS:0000000000000000
>[    0.119642] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>[    0.120077] CR2: ffff88827ffff000 CR3: 0000000002c30001 CR4: 0000000000770ef0
>[    0.120537] PKRU: 55555554
>[    0.121078] Kernel panic - not syncing: Attempted to kill the idle task!
>[    0.121545] ---[ end Kernel panic - not syncing: Attempted to kill
>the idle task! ]---
>

That a UD2 opcode...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.