[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <CEF166D9-6C75-4C54-8C6E-69FF730D8D2F@fau.de>
Date: Mon, 17 May 2021 17:47:58 +0200
From: Vanessa Hack <vanessa.hack@....de>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org,
Jonas Rabenstein <rabenstein@...fau.de>
Subject: Re: [PATCH] objtool: include symbol value in check for contiguous
objects
Hi Josh,
I think there might have been a problem with my mail client, so I’m sorry
if this has been sent twice.
> I believe add_jump_table() -- in addition to all the other jump table
> code -- assumes that reloc->sym is a section symbol (STT_SECTION),
> rather than a function symbol (STT_FUNC). Was it an STT_FUNC symbol
> which caused the problem?
Indeed as you proposed it was a symbol with another type than STT_SECTION
that caused the problem. This resulted of our mistake of not having compiled
our code using -fno-pic and the fact, that it was i386 code as we are trying to
adapt objtool for our 32 bit operating system. Consequently, local labels for a
switch jump table were created, which the existing objtool code seems not to
be intended to handle.
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 5e5388a38e2a..4f30a763a4e3 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -1344,6 +1344,10 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn,
> if (prev_offset && reloc->offset != prev_offset + 8)
> break;
>
> + /* Jump table relocs are always STT_SECTION: */
> + if (reloc->sym->type != STT_SECTION)
> + break;
> +
> /* Detect function pointers from contiguous objects: */
> if (reloc->sym->sec == pfunc->sec &&
> reloc->addend == pfunc->offset)
Your suggested patch would have helped us detecting the problem earlier and
seems like a good idea to check.
Regards,
Vanessa
Powered by blists - more mailing lists