lkml.org 
[lkml]   [2023]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] objtool: Generate ORC data for __pfx code
On Thu, Apr 13, 2023 at 09:24:49PM +0200, Peter Zijlstra wrote:
> On Thu, Apr 13, 2023 at 08:29:33AM -0700, Josh Poimboeuf wrote:
> > 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?
>
> Hmm, I was thikning that since we don't know the size of the
> instructions being written, we need CFI for all offsets. But perhaps,
> since we do a left-match on IP, only one entry at the __pfx+0 location
> would work?

Right, while in objtool (almost) every insn has insn->cfi, the actual
ORC entries only get created at the boundaries of change.

--
Josh

\
 
 \ /
  Last update: 2023-04-13 21:31    [W:0.026 / U:1.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site