public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Borislav Petkov <bp@alien8.de>
Cc: david.kaplan@amd.com, jpoimboe@redhat.com,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [RFC][PATCH 2/2] x86: Clean up default rethunk warning
Date: Mon, 4 Nov 2024 15:29:53 +0100	[thread overview]
Message-ID: <20241104142953.GG24862@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20241104114728.GTZyi0UHYKx-ZHL4kh@fat_crate.local>

On Mon, Nov 04, 2024 at 12:47:28PM +0100, Borislav Petkov wrote:
> On Mon, Oct 07, 2024 at 10:32:12AM +0200, Peter Zijlstra wrote:
> > -	.section .text..__x86.indirect_thunk
> > +#define WARN_ONCE							\
> 
> This should be in the asm section of arch/x86/include/asm/bug.h so that other
> asm code can use it. It will come in handy...
> 
> > +	1: ALTERNATIVE "", "ud2", X86_FEATURE_ALWAYS ;			\
> 
> ... but uff, you can't because of this ALTERNATIVE. This is a conditional
> WARN_ONCE.  Yuck.
> 
> I guess ALT_WARN_ONCE or so...

Yeah, Josh already said similar things.

> > +	ASM_BUGTABLE_FLAGS(1b, 0, 0, BUGFLAG_WARNING | BUGFLAG_ONCE) ;	\
> > +	REACHABLE
> >  
> > +	.section .text..__x86.indirect_thunk
> >  
> >  .macro POLINE reg
> >  	ANNOTATE_INTRA_FUNCTION_CALL
> > @@ -382,16 +387,15 @@ SYM_FUNC_END(call_depth_return_thunk)
> >  SYM_CODE_START(__x86_return_thunk)
> >  	UNWIND_HINT_FUNC
> >  	ANNOTATE_NOENDBR
> > -#if defined(CONFIG_MITIGATION_UNRET_ENTRY) || \
> > -    defined(CONFIG_MITIGATION_SRSO) || \
> > -    defined(CONFIG_MITIGATION_CALL_DEPTH_TRACKING)
> > -	ALTERNATIVE __stringify(ANNOTATE_UNRET_SAFE; ret), \
> > -		   "jmp warn_thunk_thunk", X86_FEATURE_ALWAYS
> > -#else
> > +
> > +#ifdef CONFIG_X86_64
> > +	WARN_ONCE
> > +#endif
> 
> And you can add an empty 32-bit WARN_ONCE macro so that we don't have this
> ifdeffery here where ifdeffery gives the last drop of making this file totally
> unreadable...

I just realized all the rethunk crap is 64bit only anyway. So it don't
matter.

But the reason I did this is that we never rewrite thunk calls on 32bit
(really, we should just strip all mitigation shit from it and leave it
to rot).


  reply	other threads:[~2024-11-04 14:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07  8:32 [RFC][PATCH 0/2] x86: ASM based __bug_table and rethunks Peter Zijlstra
2024-10-07  8:32 ` [RFC][PATCH 1/2] x86: Provide assembly __bug_table helpers Peter Zijlstra
2024-10-07 17:21   ` Josh Poimboeuf
2024-10-23 11:22   ` Borislav Petkov
2024-10-07  8:32 ` [RFC][PATCH 2/2] x86: Clean up default rethunk warning Peter Zijlstra
2024-10-07 17:33   ` Josh Poimboeuf
2024-10-08  7:25     ` Peter Zijlstra
2024-10-08 16:45       ` Josh Poimboeuf
2024-10-09  7:59         ` Peter Zijlstra
2024-11-04 11:47   ` Borislav Petkov
2024-11-04 14:29     ` Peter Zijlstra [this message]
2024-11-04 14:39       ` Borislav Petkov

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=20241104142953.GG24862@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=david.kaplan@amd.com \
    --cc=jpoimboe@redhat.com \
    --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