Thread (52 messages) 52 messages, 7 authors, 2025-06-06

Re: [PATCH v2 00/13] objtool: Detect and warn about indirect calls in __nocfi functions

From: Peter Zijlstra <peterz@infradead.org>
Date: 2025-05-28 16:30:42
Also in: kvm, linux-efi, lkml

On Wed, May 28, 2025 at 09:44:52AM +0200, Peter Zijlstra wrote:
On Tue, May 06, 2025 at 12:18:49PM -0700, Josh Poimboeuf wrote:
quoted
Weird, I'm not seeing that.
I Ate'nt Crazeh...

https://lore.kernel.org/all/202505280410.2qfTQCRt-lkp@intel.com/T/#u (local)

I'll go poke at it, see if today is the day I can figure out WTF
happens.
It manages to trip the CFI_UNDEFINED case in op->dest.reg == cfa->base
in update_cfi_state().

I figured it ought to tickle the regular 'mov %rbp, %rsp' case above
there, but it doesn't, for some reason it has cfa.base == SP at this
point.

This happens... /me looks in scrollback ... at POP_REGS 'pop
%rbp'. ARGH!!


So the sequence of fail is:

	push %rbp
	mov %rsp, %rbp	# cfa.base = BP

	SAVE
	...
	push %rbp
	...
	pop %rbp	# cfa.base = SP
	...
	mov %rbp, %rsp  # UNDEF
	nop		# FAIL
	RESTORE

Note that the MOV+NOP is the 4 bytes ERETS needs.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help