All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	hjl.tools@gmail.com, andrew.cooper3@citrix.com,
	mark.rutland@arm.com, will@kernel.org, ndesaulniers@google.com
Subject: Re: [PATCH 3/3] x86: Add straight-line-speculation mitigation
Date: Fri, 19 Nov 2021 09:15:43 -0800	[thread overview]
Message-ID: <202111190911.1F5CEA6DA@keescook> (raw)
In-Reply-To: <20211119165630.334945680@infradead.org>

On Fri, Nov 19, 2021 at 05:50:26PM +0100, Peter Zijlstra wrote:
> This little patch makes use of an upcomming GCC feature to mitigate
> straight-line-speculation for x86:
> 
>   https://gcc.gnu.org/g:53a643f8568067d7700a9f2facc8ba39974973d3
>   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952
>   https://bugs.llvm.org/show_bug.cgi?id=52323
> 
> It's built tested on x86_64-allyesconfig using GCC-12 and GCC-11.
> It's also been boot tested on x86_64-defconfig+kvm_guest.config using
> GCC-12.
> 
> Maintenace overhead of this should be fairly low due to objtool
> validation.
> 
> Size overhead of all these additional int3 instructions comes to:
> 
>    text	   data	    bss	    dec	    hex	filename
> 22267751	6933356	2011368	31212475	1dc43bb	defconfig-build/vmlinux
> 22804126	6933356	1470696	31208178	1dc32f2	defconfig-build/vmlinux.sls
> 
> Or roughly 2.4% additional text.

Thanks for adding the size details. (I remain surprised it's so much.)

> [...]
>  125 files changed, 441 insertions(+), 386 deletions(-)

I wonder if this patch should be split into a few pieces:

- objtool validation
- asm macro definitions
- mechanical ret/RET replacement
- Kconfig & Makefile

Personally I'd find that much easier to review, but either way:

Reviewed-by: Kees Cook <keescook@chromium.org>

Thanks!

-- 
Kees Cook

      reply	other threads:[~2021-11-19 17:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 16:50 [PATCH 0/3] x86: Add GCC-12 features Peter Zijlstra
2021-11-19 16:50 ` [PATCH 1/3] x86: Move RETPOLINE*_CFLAGS to arch Makefile Peter Zijlstra
2021-11-19 17:10   ` Kees Cook
2021-11-19 19:02   ` Nick Desaulniers
2021-12-10 11:05   ` [tip: x86/core] " tip-bot2 for Peter Zijlstra
2021-11-19 16:50 ` [PATCH 2/3] x86: Use -mindirect-branch-cs-prefix for RETPOLINE builds Peter Zijlstra
2021-11-19 17:10   ` Kees Cook
2021-12-10 11:05   ` [tip: x86/core] " tip-bot2 for Peter Zijlstra
2021-11-19 16:50 ` [PATCH 3/3] x86: Add straight-line-speculation mitigation Peter Zijlstra
2021-11-19 17:15   ` Kees Cook [this message]

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=202111190911.1F5CEA6DA@keescook \
    --to=keescook@chromium.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=hjl.tools@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.