From: Peter Zijlstra <peterz@infradead.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Sathvika Vasireddy <sv@linux.ibm.com>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH v1 3/3] powerpc: WIP draft support to objtool check
Date: Fri, 16 Jun 2023 16:43:37 +0200 [thread overview]
Message-ID: <20230616144337.GQ83892@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <8fbf16dd6a89e1b5b05244bd5e0746410674829e.1686922583.git.christophe.leroy@csgroup.eu>
Few comments..
On Fri, Jun 16, 2023 at 03:47:52PM +0200, Christophe Leroy wrote:
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 0fcf99c91400..f945fe271706 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -236,6 +236,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
> "x86_64_start_reservations",
> "xen_cpu_bringup_again",
> "xen_start_kernel",
> + "longjmp",
> };
>
> if (!func)
> @@ -2060,13 +2061,12 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn,
> * instruction.
> */
> list_for_each_entry_from(reloc, &table->sec->reloc_list, list) {
> -
> /* Check for the end of the table: */
> if (reloc != table && reloc->jump_table_start)
> break;
>
> /* Make sure the table entries are consecutive: */
> - if (prev_offset && reloc->offset != prev_offset + 8)
> + if (prev_offset && reloc->offset != prev_offset + 4)
Do we want a global variable (from elf.c) called elf_sizeof_long or so?
> break;
>
> /* Detect function pointers from contiguous objects: */
> @@ -2074,7 +2074,10 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn,
> reloc->addend == pfunc->offset)
> break;
>
> - dest_insn = find_insn(file, reloc->sym->sec, reloc->addend);
> + if (table->jump_table_is_rel)
> + dest_insn = find_insn(file, reloc->sym->sec, reloc->addend + table->offset - reloc->offset);
> + else
> + dest_insn = find_insn(file, reloc->sym->sec, reloc->addend);
offset = reloc->addend;
if (table->jump_table_is_rel)
offset += table->offset - reloc->offset;
dest_insn = find_insn(file, reloc->sym->sec, offset);
perhaps?
> if (!dest_insn)
> break;
>
> @@ -4024,6 +4022,11 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
> if (insn->ignore || insn->type == INSN_NOP || insn->type == INSN_TRAP)
> return true;
>
> + /* powerpc relocatable files have a word in front of each relocatable function */
> + if ((file->elf->ehdr.e_machine == EM_PPC || file->elf->ehdr.e_machine == EM_PPC64) &&
> + (file->elf->ehdr.e_flags & EF_PPC_RELOCATABLE_LIB) &&
> + insn_func(next_insn_same_sec(file, insn)))
> + return true;
Can't you simply decode that word to INSN_NOP or so?
prev parent reply other threads:[~2023-06-16 14:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 13:47 [RFC PATCH v1 0/3] powerpc/objtool: First step towards uaccess validation (v1) Christophe Leroy
2023-06-16 13:47 ` [RFC PATCH v1 1/3] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto" Christophe Leroy
2023-06-20 5:21 ` Naveen N Rao
2023-06-20 7:10 ` Peter Zijlstra
2023-06-16 13:47 ` [RFC PATCH v1 2/3] powerpc: Mark all .S files invalid for objtool Christophe Leroy
2023-06-20 6:04 ` Naveen N Rao
2023-06-20 6:15 ` Christophe Leroy
2023-06-20 6:40 ` Naveen N Rao
2023-06-16 13:47 ` [RFC PATCH v1 3/3] powerpc: WIP draft support to objtool check Christophe Leroy
2023-06-16 14:43 ` Peter Zijlstra [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=20230616144337.GQ83892@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=christophe.leroy@csgroup.eu \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=sv@linux.ibm.com \
/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
Powered by JetHome