Re: [PATCH v2 00/13] objtool: Detect and warn about indirect calls in __nocfi functions
From: Josh Poimboeuf
Date: Tue Jun 03 2025 - 01:43:52 EST
On Thu, May 29, 2025 at 11:30:17AM +0200, Peter Zijlstra wrote:
> > > 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