lkml.org 
[lkml]   [2018]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] x86/retpoline: Fill return stack buffer on vmexit
Date
From
On Wed, 2018-01-10 at 15:47 -0800, Tim Chen wrote:
>
> > +
> > +     asm volatile (ALTERNATIVE("",
> > +                               __stringify(__FILL_RETURN_BUFFER(%0, %1, _%=)),
> > +                               X86_FEATURE_RETPOLINE)
>
> We'll be patching in a fairly long set of instructions here.  Maybe put
> the ALTERNATIVE in the assembly and use a jmp skip_\@ for the ALTERNATIVE.

Perhaps the alternatives.h header could give me a clean way of doing this:

--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -177,7 +178,7 @@ static inline void vmexit_fill_RSB(void)
 {
        unsigned long dummy;
 
-       asm volatile (ALTERNATIVE("",
+       asm volatile (ALTERNATIVE("jmp " alt_end_marker "f",
                                  __stringify(__FILL_RETURN_BUFFER(%0, %1, _%=)),
                                  X86_FEATURE_RETPOLINE)
                      : "=r" (dummy), ASM_CALL_CONSTRAINT : : "memory" );[unhandled content-type:application/x-pkcs7-signature]
\
 
 \ /
  Last update: 2018-01-14 23:22    [W:0.123 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site