mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH 10/18] objtool: Extricate ibt from stack validation
Date: Thu, 14 Apr 2022 12:07:51 -0700	[thread overview]
Message-ID: <20220414190526.klnrtc3behsbxftb@treble> (raw)
In-Reply-To: <YlhvpGsUFIOLByhp@hirez.programming.kicks-ass.net>

On Thu, Apr 14, 2022 at 09:01:56PM +0200, Peter Zijlstra wrote:
> > diff --git a/arch/x86/lib/putuser.S b/arch/x86/lib/putuser.S
> > index ecb2049c1273..b7dfd60243b7 100644
> > --- a/arch/x86/lib/putuser.S
> > +++ b/arch/x86/lib/putuser.S
> > @@ -48,6 +48,7 @@ SYM_FUNC_START(__put_user_1)
> >  	cmp %_ASM_BX,%_ASM_CX
> >  	jae .Lbad_put_user
> >  SYM_INNER_LABEL(__put_user_nocheck_1, SYM_L_GLOBAL)
> > +	ENDBR
> >  	ASM_STAC
> >  1:	movb %al,(%_ASM_CX)
> >  	xor %ecx,%ecx
> > @@ -62,6 +63,7 @@ SYM_FUNC_START(__put_user_2)
> >  	cmp %_ASM_BX,%_ASM_CX
> >  	jae .Lbad_put_user
> >  SYM_INNER_LABEL(__put_user_nocheck_2, SYM_L_GLOBAL)
> > +	ENDBR
> >  	ASM_STAC
> >  2:	movw %ax,(%_ASM_CX)
> >  	xor %ecx,%ecx
> > @@ -76,6 +78,7 @@ SYM_FUNC_START(__put_user_4)
> >  	cmp %_ASM_BX,%_ASM_CX
> >  	jae .Lbad_put_user
> >  SYM_INNER_LABEL(__put_user_nocheck_4, SYM_L_GLOBAL)
> > +	ENDBR
> >  	ASM_STAC
> >  3:	movl %eax,(%_ASM_CX)
> >  	xor %ecx,%ecx
> > @@ -90,6 +93,7 @@ SYM_FUNC_START(__put_user_8)
> >  	cmp %_ASM_BX,%_ASM_CX
> >  	jae .Lbad_put_user
> >  SYM_INNER_LABEL(__put_user_nocheck_8, SYM_L_GLOBAL)
> > +	ENDBR
> >  	ASM_STAC
> >  4:	mov %_ASM_AX,(%_ASM_CX)
> >  #ifdef CONFIG_X86_32
> 
> Hmm, how did those go missing?

Because the current code only warns about references from .data/.rodata.
This patch changes that.

> > diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S
> > index 5f87bab4fb8d..b2b2366885a2 100644
> > --- a/arch/x86/lib/retpoline.S
> > +++ b/arch/x86/lib/retpoline.S
> > @@ -31,6 +31,7 @@
> >  	.align RETPOLINE_THUNK_SIZE
> >  SYM_INNER_LABEL(__x86_indirect_thunk_\reg, SYM_L_GLOBAL)
> >  	UNWIND_HINT_EMPTY
> > +	ANNOTATE_NOENDBR
> >  
> >  	ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), \
> >  		      __stringify(RETPOLINE \reg), X86_FEATURE_RETPOLINE, \
> > @@ -55,7 +56,6 @@ SYM_INNER_LABEL(__x86_indirect_thunk_\reg, SYM_L_GLOBAL)
> >  
> >  	.align RETPOLINE_THUNK_SIZE
> >  SYM_CODE_START(__x86_indirect_thunk_array)
> > -	ANNOTATE_NOENDBR // apply_retpolines
> >  
> >  #define GEN(reg) THUNK reg
> >  #include <asm/GEN-for-each-reg.h>
> 
> Hmm, where does that come from? Do you have commit be8a096521ca
> ("x86,bpf: Avoid IBT objtool warning")?

Same answer as above, this patch now warns about exported symbols with
missing ENDBR.

-- 
Josh


  reply	other threads:[~2022-04-14 19:08 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 23:19 [PATCH 00/18] objtool: Interface overhaul Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 01/18] objtool: Enable unreachable warnings for CLANG LTO Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 02/18] objtool: Support data symbol printing Josh Poimboeuf
2022-04-14  7:05   ` Peter Zijlstra
2022-04-14 15:21     ` Josh Poimboeuf
2022-04-14 15:31       ` Peter Zijlstra
2022-04-14 15:38         ` Josh Poimboeuf
2022-04-14 16:36           ` Peter Zijlstra
2022-04-14 17:01             ` Josh Poimboeuf
2022-04-14 17:21               ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 03/18] objtool: Add sec+offset to warnings Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 04/18] objtool: Print data address for "!ENDBR" data warnings Josh Poimboeuf
2022-04-14  7:36   ` Peter Zijlstra
2022-04-13 23:19 ` [PATCH 05/18] objtool: Use offstr() to print address of missing ENDBR Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 06/18] libsubcmd: Fix OPTION_GROUP sorting Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 07/18] objtool: Reorganize cmdline options Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 08/18] objtool: Ditch subcommands Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 09/18] objtool: Add stack validation cmdline option Josh Poimboeuf
2022-04-14  8:43   ` Peter Zijlstra
2022-04-14 15:52     ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 10/18] objtool: Extricate ibt from stack validation Josh Poimboeuf
2022-04-14  7:53   ` Peter Zijlstra
2022-04-14 15:44     ` Josh Poimboeuf
2022-04-14 16:38       ` Peter Zijlstra
2022-04-14 17:05         ` Josh Poimboeuf
2022-04-14 18:25           ` Josh Poimboeuf
2022-04-14 19:01             ` Peter Zijlstra
2022-04-14 19:07               ` Josh Poimboeuf [this message]
2022-04-14 18:49           ` Peter Zijlstra
2022-04-13 23:19 ` [PATCH 11/18] objtool: Add CONFIG_OBJTOOL Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 12/18] objtool: Make stack validation frame-pointer-specific Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 13/18] objtool: Add static call cmdline option Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 14/18] objtool: Add toolchain hacks " Josh Poimboeuf
2022-04-14  8:09   ` Peter Zijlstra
2022-04-14 15:49     ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 15/18] objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION" Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 16/18] objtool: Add HAVE_NOINSTR_VALIDATION Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 17/18] objtool: Remove --lto and --vmlinux Josh Poimboeuf
2022-04-14  8:13   ` Peter Zijlstra
2022-04-15  2:18     ` Josh Poimboeuf
2022-04-13 23:19 ` [PATCH 18/18] objtool: Update documentation Josh Poimboeuf

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=20220414190526.klnrtc3behsbxftb@treble \
    --to=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.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®