[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMj1kXFaqij=OiJcPY7RcDd79V5qDKkXcxLbqNcnk7nBxiu=Bg@mail.gmail.com>
Date: Fri, 11 Oct 2024 18:50:55 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Ard Biesheuvel <ardb+git@...gle.com>, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
keescook@...omium.org, linux-hardening@...r.kernel.org, nathan@...nel.org,
Peter Zijlstra <peterz@...radead.org>, Jan Beulich <jbeulich@...e.com>,
"Jose E. Marchesi" <jemarch@....org>, Kees Cook <kees@...nel.org>
Subject: Re: [PATCH v2 2/5] objtool: Allow arch code to discover jump table size
On Thu, 10 Oct 2024 at 21:52, Josh Poimboeuf <jpoimboe@...nel.org> wrote:
>
> On Thu, Oct 10, 2024 at 02:28:04PM +0200, Ard Biesheuvel wrote:
> > @@ -2222,7 +2234,6 @@ static void mark_func_jump_tables(struct objtool_file *file,
> > struct symbol *func)
> > {
> > struct instruction *insn, *last = NULL;
> > - struct reloc *reloc;
> >
> > func_for_each_insn(file, func, insn) {
> > if (!last)
> > @@ -2245,9 +2256,7 @@ static void mark_func_jump_tables(struct objtool_file *file,
> > if (insn->type != INSN_JUMP_DYNAMIC)
> > continue;
> >
> > - reloc = find_jump_table(file, func, insn);
> > - if (reloc)
> > - insn->_jump_table = reloc;
> > + find_jump_table(file, func, insn);
>
> Can we detect the annotation here, and if it exists, pivot to a separate
> generic implementation which skips all the arch-specific code and hacks?
>
> That way we could keep the "ugly" separate, and also have all arches
> supported by default.
>
I had a stab at this, and while the code changes are a bit intrusive,
the end result is much better for it (IMHO).
In the end, the logic in arch_find_switch_table() is mostly generic
anyway, but it is the code traversal in check.c that is the "ugly". So
I moved lots of things around. I'll send that out before signing off
today.
Powered by blists - more mailing lists