lkml.org 
[lkml]   [2021]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH V4 04/50] x86/xen: Add xenpv_restore_regs_and_return_to_usermode()
From


On 2021/11/2 16:58, Borislav Petkov wrote:

>> */
>>
>> - ALTERNATIVE "", "jmp swapgs_restore_regs_and_return_to_usermode", \
>> + ALTERNATIVE "", "jmp xenpv_restore_regs_and_return_to_usermode", \
>
> Instead of sprinkling all those ALTERNATIVE calls everywhere,
> why don't you simply jump to the xenpv-one at the
> swapgs_restore_regs_and_return_to_usermode label itself and have a
> single ALTERNATIVE there?
>

It will add a 5-byte NOP at the beginning of the native
swapgs_restore_regs_and_return_to_usermode. I avoided adding unneeded
code in the native code even if it is NOPs and avoided melting xenpv-one into
the native one which will reduce the code readability.

I will follow your preference since a 5-byte NOP is so negligible in the slow
path with an iret instruction.

Or other option that adds macros to wrap the ALTERNATIVE.
RESTORE_REGS_AND_RETURN_TO_USERMODE and
COND_RESTORE_REGS_AND_RETURN_TO_USERMODE (test %eax before jmp in native case)


\
 
 \ /
  Last update: 2021-11-02 10:20    [W:0.116 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site