Re: [PATCH v4 00/28] objtool: Function validation tracing

From: Alexandre Chartre
Date: Mon Nov 17 2025 - 04:47:41 EST



On 11/17/25 10:42, David Laight wrote:
On Mon, 17 Nov 2025 08:50:45 +0100
Alexandre Chartre <alexandre.chartre@xxxxxxxxxx> wrote:

On 11/14/25 22:34, Josh Poimboeuf wrote:
...
David raises the issue that a side-by-side display requires a large window.

The compact display could be like this:

Alternative with single instruction:

bb8: do_one_initcall+0x1a8 <alternative.bb8>
= callq *0x0(%rip) # 0xbbe <pv_ops+0xf8> (if default)
= sti (if !X86_FEATURE_XENPV)
= callq BUG_func (if +X86_FEATURE_ALWAYS)

Alternative with multiple instructions:

82e7: __switch_to_asm+0x27 <alternative.82e7>
= DEFAULT
82e7: __switch_to_asm+0x27 | jmp 0x8312 <__switch_to_asm+0x52>
|
= !X86_FEATURE_ALWAYS
82e7: __switch_to_asm+0x27 | NOP1
82e8: __switch_to_asm+0x28 | NOP1
82e9: __switch_to_asm+0x29 | callq 0x82ef <__switch_to_asm+0x2f>
82ee: __switch_to_asm+0x2e | int3
82ef: __switch_to_asm+0x2f | add $0x8,%rsp
82f3: __switch_to_asm+0x33 | lfence
|
= X86_FEATURE_RSB_CTXSW
82e7: __switch_to_asm+0x27 | mov $0x10,%r12
82ee: __switch_to_asm+0x2e | callq 0x82f4 <__switch_to_asm+0x34>
82f3: __switch_to_asm+0x33 | int3
82f4: __switch_to_asm+0x34 | callq 0x82fa <__switch_to_asm+0x3a>
82f9: __switch_to_asm+0x39 | int3
82fa: __switch_to_asm+0x3a | add $0x10,%rsp
82fe: __switch_to_asm+0x3e | dec %r12
8301: __switch_to_asm+0x41 | jne 0x82ee <__switch_to_asm+0x2e>
8303: __switch_to_asm+0x43 | lfence
8306: __switch_to_asm+0x46 | movq $0xffffffffffffffff,%gs:0x0(%rip) # 0x20b <__x86_call_depth>

That does looks better.
Although I think there ought to be some indication of the 31 NOP bytes
at the end of the middle alternative.

I am now compacting the code by removing all trailing NOPs. I should probably
improve that with printing the actual number of NOPs, for example NOP31 (or nop31)

I'd also decode those callq as 'callq .+6' - not sure what other people think?
It is rather specific to that code.

This is done by libopcodes. I will need to check if there is an option to display
the branch distance instead of the branch target.

Thanks,

alex.