lkml.org 
[lkml]   [2022]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2022-04-20 19:27    [W:0.387 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site