Re: [PATCH 3/3] objtool: Generate ORC data for __pfx code

From: Josh Poimboeuf
Date: Thu Apr 13 2023 - 11:29:40 EST


On Thu, Apr 13, 2023 at 01:24:26PM +0200, Peter Zijlstra wrote:
> > + if (!insn->cfi) {
> > + /*
> > + * This can happen if stack validation isn't enabled or the
> > + * function is annotated with STACK_FRAME_NON_STANDARD.
> > + */
> > + return 0;
> > + }
> > +
> > + /* Propagate insn->cfi to the prefix code */
> > + cfi = cfi_hash_find_or_add(insn->cfi);
> > + for (; prev != insn; prev = next_insn_same_sec(file, prev))
> > + prev->cfi = cfi;
> > +
> > return 0;
> > }
>
> FWIW, this makes the whole thing hard rely on the prefix being single
> byte NOPs -- which they are, but perhaps we should assert this?

Couldn't they be any stack-invariant instructions?

--
Josh