[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+veayfD70Xsu8UnNrLdRW6rh9jxPb=OGoiYT-O=_zW=A@mail.gmail.com>
Date: Wed, 26 Jun 2019 18:42:40 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Song Liu <songliubraving@...com>,
Kairui Song <kasong@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH v3 2/4] objtool: Add support for C jump tables
On Wed, Jun 26, 2019 at 5:38 PM Josh Poimboeuf <jpoimboe@...hat.com> wrote:
>
> Objtool doesn't know how to read C jump tables, so it has to whitelist
> functions which use them, causing missing ORC unwinder data for such
> functions, e.g. ___bpf_prog_run().
>
> C jump tables are very similar to GCC switch jump tables, which objtool
> already knows how to read. So adding support for C jump tables is easy.
> It just needs to be able to find the tables and distinguish them from
> other data.
>
> To allow the jump tables to be found, create a standard: objtool will
> automatically recognize any static local jump table named "jump_table".
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> tools/objtool/check.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 172f99195726..8341c2fff14f 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -18,6 +18,8 @@
>
> #define FAKE_JUMP_OFFSET -1
>
> +#define JUMP_TABLE_SYM_PREFIX "jump_table."
> +
> struct alternative {
> struct list_head list;
> struct instruction *insn;
> @@ -997,6 +999,7 @@ static struct rela *find_switch_table(struct objtool_file *file,
> struct instruction *orig_insn = insn;
> struct section *rodata_sec;
> unsigned long table_offset;
> + struct symbol *sym;
>
> /*
> * Backward search using the @first_jump_src links, these help avoid
> @@ -1035,9 +1038,18 @@ static struct rela *find_switch_table(struct objtool_file *file,
>
> /*
> * Make sure the .rodata address isn't associated with a
> - * symbol. gcc jump tables are anonymous data.
> + * symbol. GCC jump tables are anonymous data.
> + *
> + * Also support C jump tables which are in the same format as
> + * switch jump tables. Each jump table should be a static
> + * local const array named "jump_table" for objtool to
> + * recognize it.
Nacked-by: Alexei Starovoitov <ast@...nel.org>
It's not acceptable for objtool to dictate kernel naming convention.
Powered by blists - more mailing lists