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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7e42a4b-cf0d-d6ad-2f66-0f52898e818a@suse.com>
Date:   Fri, 10 Mar 2023 07:24:17 +0100
From:   Juergen Gross <jgross@...e.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        virtualization@...ts.linux-foundation.org,
        "Srivatsa S. Bhat (VMware)" <srivatsa@...il.mit.edu>,
        Alexey Makhalov <amakhalov@...are.com>,
        VMware PV-Drivers Reviewers <pv-drivers@...are.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] x86/paravirt: convert simple paravirt functions to asm

On 09.03.23 14:39, Borislav Petkov wrote:
> On Wed, Mar 08, 2023 at 04:42:10PM +0100, Juergen Gross wrote:
>> All functions referenced via __PV_IS_CALLEE_SAVE() need to be assembler
>> functions, as those functions calls are hidden from gcc. In case the
>> kernel is compiled with "-fzero-call-used-regs" the compiler will
>> clobber caller-saved registers at the end of C functions, which will
>> result in unexpectedly zeroed registers at the call site of the
>> related paravirt functions.
>>
>> Replace the C functions with DEFINE_PARAVIRT_ASM() constructs using
>> the same instructions as the related paravirt calls in the
>> PVOP_ALT_[V]CALLEE*() macros.
>>
>> Signed-off-by: Juergen Gross <jgross@...e.com>
>> ---
>>   arch/x86/include/asm/paravirt_types.h |  8 +++++++-
>>   arch/x86/kernel/paravirt.c            | 27 ++++++---------------------
>>   2 files changed, 13 insertions(+), 22 deletions(-)
> 
> Right, works with my particular reproducer.
> 
> Turning them into asm prevents the compiler from doing the
> callee-clobbered zeroing and that's fine as this whole paravirt gunk is
> hiding the "CALL" insn from it and you putting them in asm is in line
> with this.
> 
> And a negative diffstat..
> 
> So yeah, I'll queue it soon unless someone objects.

Thanks.

> Long term, I think we should continue switching all that pv stuff to
> using the alternatives.

The "normal" cases not using alternatives should rather be switched to
static calls.

Whether it is possible to mix a static call with alternatives needs to
be evaluated.


Juergen

Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3099 bytes)

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ