mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: David Laight <david.laight.linux@gmail.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	jpoimboe@kernel.org, leitao@debian.org, keescook@chromium.org,
	hpa@zytor.com
Subject: Re: [PATCH 4/6] x86_64/entry: Mark all syscalls __noendbr
Date: Tue, 3 Nov 2026 09:51:43 +0100	[thread overview]
Message-ID: <20261103085143.GX2668564@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261102170630.1dfc00eb@pumpkin>

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;
 
 			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;

  reply	other threads:[~2026-11-03  8:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 11:25 [PATCH 0/6] x86: Harden syscall dispatch Peter Zijlstra
2026-11-02 11:25 ` [PATCH 1/6] x86_64/entry: Unconditionally use -fno-jump-table Peter Zijlstra
2026-11-02 14:28   ` Breno Leitao
2026-11-02 11:25 ` [PATCH 2/6] objtool: Add instrumentation_weak() Peter Zijlstra
2026-11-02 11:25 ` [PATCH 3/6] x86_64/entry: Make syscall dispatch noinstr Peter Zijlstra
2026-11-02 11:25 ` [PATCH 4/6] x86_64/entry: Mark all syscalls __noendbr Peter Zijlstra
2026-11-02 17:06   ` David Laight
2026-11-03  8:51     ` Peter Zijlstra [this message]
2026-11-03 21:54       ` David Laight
2026-11-02 11:25 ` [PATCH 5/6] objtool: Allow EXPORT_SYMBOL() of __noendbr functions Peter Zijlstra
2026-11-02 11:25 ` [PATCH 6/6] x86_64/entry: Mark C noinstr __noendbr Peter Zijlstra

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=20261103085143.GX2668564@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=david.laight.linux@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=keescook@chromium.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®