lkml.org 
[lkml]   [2022]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/build: Move '-mindirect-branch-cs-prefix' out of GCC-only block
On Wed, Aug 17, 2022 at 03:08:01PM -0700, Nick Desaulniers wrote:
> On Wed, Aug 17, 2022 at 11:56 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > LLVM 16 will have support for this flag so move it out of the GCC-only
> > block to allow LLVM builds to take advantage of it.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1665
> > Link: https://github.com/llvm/llvm-project/commit/6f867f9102838ebe314c1f3661fdf95700386e5a
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> Thanks for the patch, I also boot tested this (in virtual guests for
> both 64b and 32b).
>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Tested-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Peter, is there anything else special about these prefixes needed to
> make use of them?

The thing to do is boot with (warning, *very* verbose):

"spectre_v2=retpoline,lfence debug-alternative"

and observe that the retpoline sites all replace:

"cs call __x86_indirect_thunk_r11" (6 bytes)

with:

"lfence; jmp *%r11" (6 bytes)


This being clang, you'll ofcourse still have a few weird:

"Jcc.d32 __x86_indirect_thunk_r11"

sites that will not be able to be replaced, but there's nothing I can do
about that other than to continue to encourage y'all to stop emitting
them ;-)

\
 
 \ /
  Last update: 2022-08-18 09:47    [W:0.138 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site