Re: [PATCH 4/6] x86_64/entry: Mark all syscalls __noendbr

From: David Laight

Date: Tue Nov 03 2026 - 16:54:54 EST


On Tue, 3 Nov 2026 09:51:43 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Mon, Nov 02, 2026 at 05:06:30PM +0000, David Laight wrote:
> > > --- a/tools/objtool/check.c
> > > +++ b/tools/objtool/check.c
> > > @@ -4672,8 +4672,15 @@ static int validate_ibt(struct objtool_f
> > > !strcmp(sec->name, "__patchable_function_entries"))
> > > continue;
> > >
> > > - for_each_reloc(sec->rsec, reloc)
> > > + for_each_reloc(sec->rsec, reloc) {
> > > + struct symbol *sym = find_symbol_containing(reloc->sec->base,
> > > + reloc_offset(reloc));
> > > +
> > > + if (sym && !strcmp(sym->name, "sys_call_table"))
> > > + continue;
> >
> > Does that slow things down somewhat?
> > Could you do it the other way around??
> > So remember the bounds of sys_call_table and just check whether the relocation
> > in inside it.
>
>
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -4676,7 +4676,7 @@ static int validate_ibt(struct objtool_f
> struct symbol *sym = find_symbol_containing(reloc->sec->base,
> reloc_offset(reloc));
>
> - if (sym && !strcmp(sym->name, "sys_call_table"))
> + if (sym && sym->syscall)
> continue;

I meant save the symbol info for sys_call_table (or maybe all of them?)
and just see in the relocation in in that region.
Seems better than checking all the symbols and then seeing is a specific
one matched.

David

>
> warnings += validate_ibt_data_reloc(file, reloc);
> --- a/tools/objtool/elf.c
> +++ b/tools/objtool/elf.c
> @@ -556,6 +556,9 @@ static int elf_add_symbol(struct elf *el
> if (strstarts(sym->name, ".klp.sym"))
> sym->klp = 1;
>
> + if (!strcmp(sym->name, "sys_call_table"))
> + sym->syscall = 1;
> +
> if (!sym->klp && !is_sec_sym(sym) && strstr(sym->name, ".cold")) {
> sym->cold = 1;
>
> --- a/tools/objtool/include/objtool/elf.h
> +++ b/tools/objtool/include/objtool/elf.h
> @@ -85,7 +85,7 @@ struct symbol {
> u8 fentry : 1;
> u8 profiling_func : 1;
> u8 warned : 1;
> - u8 embedded_insn : 1;
> + u8 embedded_insn : 1; // 8
> u8 local_label : 1;
> u8 frame_pointer : 1;
> u8 ignore : 1;
> @@ -93,11 +93,12 @@ struct symbol {
> u8 cold : 1;
> u8 prefix : 1;
> u8 debug_checksum : 1;
> - u8 changed : 1;
> + u8 changed : 1; // 16
> u8 included : 1;
> u8 klp : 1;
> u8 dont_correlate : 1;
> u8 fake : 1;
> + u8 syscall : 1;
> struct list_head pv_target;
> struct reloc *relocs;
> struct section *group_sec;