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

From: 李则良

Date: Thu Aug 13 2026 - 15:40:23 EST


>
> That's not what I asked, now was it. I asked what opcodes it does
> generate. Disassemble an affected function and show the difference
> between the normal -O2 and your -O1 build that causes the failure.
on vmlinux-O1:
(gdb) until arch/x86/kernel/alternative.c:557
alt_replace_call (instr=0xffffffff82f447e5 <early_fixup_exception+133>
"\377S\b\220\220\353\371[A\\]\303\314\314\314\314\303\314\314\314\314f\017\037D",
insn_buff=0xffffffff82c03d78 <init_thread_union+15736>
"\350\263\177\020\377",
a=0xffffffff831dae0e) at arch/x86/kernel/alternative.c:557
557 pr_err("ALT_FLAG_DIRECT_CALL set for unrecognized indirect call\n");
vmlinux-O1:
0xffffffff82f447e5 <+133>: ff 53 08 call QWORD PTR [rbx+0x8]
0xffffffff82f447e8 <+136>: 90 nop
0xffffffff82f447e9 <+137>: 90 nop
0xffffffff82f447ea <+138>: eb f9 jmp
0xffffffff82f447e5 <early_fixup_exception+133>
0xffffffff82f447ec <+140>: 5b pop rbx
0xffffffff82f447ed <+141>: 41 5c pop r12

vmlinux-O2:
0xffffffff82f3bf4b <+123>: 74 b0 je
0xffffffff82f3befd <early_fixup_exception+45>
0xffffffff82f3bf4d <+125>: eb 08 jmp
0xffffffff82f3bf57 <early_fixup_exception+135>
0xffffffff82f3bf4f <+127>: ff 15 33 32 d0 ff call QWORD PTR
[rip+0xffffffffffd03233] # 0xffffffff82c3f188 <pv_ops+8>
0xffffffff82f3bf55 <+133>: eb f8 jmp
0xffffffff82f3bf4f <early_fixup_exception+127>
0xffffffff82f3bf57 <+135>: 5b pop rbx
0xffffffff82f3bf58 <+136>: 41 5c pop r12
0xffffffff82f3bf5a <+138>: 5d pop rbp

I use the patch below to bypass the problem while keeping all logic of
alt_replace_call intact.