[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220228183655.gcacvddofbaaiqhz@treble>
Date: Mon, 28 Feb 2022 10:36:55 -0800
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: x86@...nel.org, joao@...rdrivepizza.com, hjl.tools@...il.com,
andrew.cooper3@...rix.com, linux-kernel@...r.kernel.org,
ndesaulniers@...gle.com, keescook@...omium.org,
samitolvanen@...gle.com, mark.rutland@....com,
alyssa.milburn@...el.com, mbenes@...e.cz, rostedt@...dmis.org,
mhiramat@...nel.org, alexei.starovoitov@...il.com
Subject: Re: [PATCH v2 34/39] objtool: Validate IBT assumptions
On Mon, Feb 28, 2022 at 10:47:55AM +0100, Peter Zijlstra wrote:
> On Sun, Feb 27, 2022 at 02:20:55PM -0800, Josh Poimboeuf wrote:
> > On Sun, Feb 27, 2022 at 06:00:03PM +0100, Peter Zijlstra wrote:
> > > > > @@ -3101,6 +3164,17 @@ static int validate_branch(struct objtoo
> > > > >
> > > > > if (insn->hint) {
> > > > > state.cfi = *insn->cfi;
> > > > > + if (ibt) {
> > > > > + struct symbol *sym;
> > > > > +
> > > > > + if (insn->cfi->type == UNWIND_HINT_TYPE_REGS_PARTIAL &&
> > > > > + (sym = find_symbol_by_offset(insn->sec, insn->offset)) &&
> > > > > + insn->type != INSN_ENDBR && !insn->noendbr) {
> > > > > + WARN_FUNC("IRET_REGS hint without ENDBR: %s",
> > > > > + insn->sec, insn->offset,
> > > > > + sym->name);
> > > > > + }
> > > >
> > > > No need to print sym->name here, WARN_FUNC() already does it?
> > >
> > > Almost; perhaps the change to make is to either introduce WARN_SYM or
> > > make WARN_FUNC also print !STT_FUNC symbols ?
> >
> > In the case of no function, WARN_FUNC() falls back to printing sec+off.
> > Is that not good enough?
>
> I got really tired of doing the manual symbol lookup... I don't suppose
> it matters too much now that I've more or less completed the triage, but
> it was useful.
Maybe it would be reasonable to change WARN_FUNC to do that? i.e. fall
back from func+off to sym+off to sec+off.
--
Josh
Powered by blists - more mailing lists