Messages in this thread | | | Date | Mon, 25 Apr 2022 08:27:17 +0200 (CEST) | From | Miroslav Benes <> | Subject | Re: [PATCH v2 15/25] objtool: Rework ibt and extricate from stack validation |
| |
On Fri, 22 Apr 2022, Peter Zijlstra wrote:
> On Wed, Apr 20, 2022 at 07:25:16PM +0200, Miroslav Benes wrote: > > A nit and it was there even before this patch... > > > > > -static struct instruction * > > > -validate_ibt_reloc(struct objtool_file *file, struct reloc *reloc) > > > -{ > > > - struct instruction *dest; > > > - struct section *sec; > > > - unsigned long off; > > > - > > > - sec = reloc->sym->sec; > > > - off = reloc->sym->offset; > > > - > > > - if ((reloc->sec->base->sh.sh_flags & SHF_EXECINSTR) && > > > - (reloc->type == R_X86_64_PC32 || reloc->type == R_X86_64_PLT32)) > > > - off += arch_dest_reloc_offset(reloc->addend); > > > > here... > > > > > +static int validate_ibt_insn(struct objtool_file *file, struct instruction *insn) > > > +{ > > > > ... > > > + off = reloc->sym->offset; > > > + if (reloc->type == R_X86_64_PC32 || reloc->type == R_X86_64_PLT32) > > > + off += arch_dest_reloc_offset(reloc->addend); > > > + else > > > + off += reloc->addend; > > > > it looks kind of strange to have arch_dest_reloc_offset() and still > > reference arch-specific relocation types here. On the other hand it seems > > difficult to achieve complete arch-agnostic code, so take it just as a > > note and maybe someone porting objtool to a different architecture will > > split the code, make it all arch-independent and all will be nice and > > shiny. > > Something like so perhaps? Seems to build and boot x86_64-defconfig.
Yes, that looks good. Thanks.
Miroslav
| |