[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230413193048.biwxfseynqyc4qkx@treble>
Date: Thu, 13 Apr 2023 12:30:48 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Miroslav Benes <mbenes@...e.cz>
Subject: Re: [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
Powered by blists - more mailing lists