| Date | Wed, 20 Apr 2022 19:25:16 +0200 (CEST) | From | Miroslav Benes <> | Subject | Re: [PATCH v2 15/25] objtool: Rework ibt and extricate from stack validation |
| |
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.
Miroslav
|