public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: x86@kernel.org, Josh Poimboeuf <jpoimboe@redhat.com>,
	keescook@chromium.org, linux-kernel@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>,
	hjl.tools@gmail.com
Subject: Re: [RFC][PATCH] x86: Add straight-line-speculation mitigation
Date: Thu, 28 Oct 2021 23:30:58 +0200	[thread overview]
Message-ID: <20211028213058.GQ174703@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <8ad13850-10fc-f8a2-c35b-4afe847b7f4e@citrix.com>

On Thu, Oct 28, 2021 at 09:06:30PM +0100, Andrew Cooper wrote:
> It would be remiss of me not to say...  In Xen, I've currently gone with:
> 
> #ifdef CONFIG_SPECULATIVE_HARDEN_STRAIGHT_LINE
> # define ret  ret;  int3
> # define retq retq; int3

#define retq ret

Surely :-)

> #endif
> 
> 
> which avoids needing to patch any asm files, and therefore is a far less
> invasive patch.

All the asm stuff was more or less:

find arch/x86/ -name \*.s | while read file;
do
	sed -i $file -e 's/\<retq?\>/RET/'
done

or thereabout. The pesky bits were the inline asm and realizing that
RETPOLINE_SAFE also means we really don't care about SLS.

> I know those defines probably deserve a WTF, and will confuse anyone who
> doesn't understand the phrase "painting blue", but they have the
> advantage that casual contributions don't need to remember to avoid
> naked `ret` instructions to maintain safety, making it a rather more
> robust option.

objtool while whinge if someone forgets

  reply	other threads:[~2021-10-28 21:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 11:44 [RFC][PATCH] x86: Add straight-line-speculation mitigation Peter Zijlstra
2021-10-28 16:51 ` Kees Cook
2021-10-28 17:11   ` Peter Zijlstra
2021-10-28 20:06 ` Andrew Cooper
2021-10-28 21:30   ` Peter Zijlstra [this message]
2021-10-29  9:33 ` David Laight

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=20211028213058.GQ174703@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=hjl.tools@gmail.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=will@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