linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vanessa Hack <vanessa.hack@fau.de>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	Jonas Rabenstein <rabenstein@cs.fau.de>
Subject: Re: [PATCH] objtool: include symbol value in check for contiguous objects
Date: Mon, 17 May 2021 17:47:58 +0200	[thread overview]
Message-ID: <CEF166D9-6C75-4C54-8C6E-69FF730D8D2F@fau.de> (raw)
In-Reply-To: <20210503172814.suquyqr737ogn4ef@treble>

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

      reply	other threads:[~2021-05-17 16:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210428210408.4546-1-vanessa.hack@fau.de>
2021-05-03 17:28 ` [PATCH] objtool: include symbol value in check for contiguous objects Josh Poimboeuf
2021-05-17 15:47   ` Vanessa Hack [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CEF166D9-6C75-4C54-8C6E-69FF730D8D2F@fau.de \
    --to=vanessa.hack@fau.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rabenstein@cs.fau.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).