lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4ae23dd-377e-8316-909b-d5bdeacc0904@linux.alibaba.com>
Date:   Tue, 2 Nov 2021 17:19:46 +0800
From:   Lai Jiangshan <laijs@...ux.alibaba.com>
To:     Borislav Petkov <bp@...en8.de>,
        Lai Jiangshan <jiangshanlai@...il.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        Jan Beulich <jbeulich@...e.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Juergen Gross <jgross@...e.com>, Peter Anvin <hpa@...or.com>,
        xen-devel@...ts.xenproject.org, Andy Lutomirski <luto@...nel.org>,
        Ingo Molnar <mingo@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Stefano Stabellini <sstabellini@...nel.org>
Subject: Re: [PATCH V4 04/50] x86/xen: Add
 xenpv_restore_regs_and_return_to_usermode()



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)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ