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: Josh Poimboeuf <jpoimboe@kernel.org>
Date: 2025-06-03 05:43:42
Also in: kvm, linux-efi, lkml

On Thu, May 29, 2025 at 11:30:17AM +0200, Peter Zijlstra wrote:
quoted
quoted
So the sequence of fail is:

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

	SAVE
	sub    $0x40,%rsp
	and    $0xffffffffffffffc0,%rsp

This hits the 'older GCC, drap with frame pointer' case in OP_SRC_AND.
Which means we then hard rely on the frame pointer to get things right.

However, per all the PUSH/POP_REGS nonsense, BP can get clobbered.
Specifically the code between the CALL and POP %rbp below are up in the
air. I don't think it can currently unwind properly there.
RBP is callee saved, so there's no need to pop it or any of the other
callee-saved regs.  If they were to change, that would break C ABI
pretty badly.  Maybe add a skip_callee=1 arg to POP_REGS?

-- 
Josh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help