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] [day] [month] [year] [list]
Message-ID: <5ad0f302-c1e1-b400-c3f3-a97c1cd443e8@amazon.com>
Date:   Tue, 10 May 2022 14:33:40 +0200
From:   Alexander Graf <graf@...zon.com>
To:     Christophe Leroy <christophe.leroy@...roup.eu>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>
CC:     "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Paul Mackerras <paulus@...ba.org>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Matt Evans <matt@...abs.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH v2] KVM: PPC: Book3S PR: Enable MSR_DR for
 switch_mmu_context()


On 10.05.22 13:31, Christophe Leroy wrote:
> Le 10/05/2022 à 13:18, Alexander Graf a écrit :
>> Commit 863771a28e27 ("powerpc/32s: Convert switch_mmu_context() to C")
>> moved the switch_mmu_context() to C. While in principle a good idea, it
>> meant that the function now uses the stack. The stack is not accessible
>> from real mode though.
>>
>> So to keep calling the function, let's turn on MSR_DR while we call it.
>> That way, all pointer references to the stack are handled virtually.
> Is the system ready to handle a DSI in case the stack is not mapped ?


A DSI itself will be an interrupt again which will in turn destroy the 
SPRG that we're saving. Guess I was trying to be too smart :). I'll use 
Matt's original suggestion and just put it on the stack.


>> In addition, make sure to save/restore r12 in an SPRG, as it may get
>> clobbered by the C function.
>>
>> Reported-by: Matt Evans <matt@...abs.org>
>> Fixes: 863771a28e27 ("powerpc/32s: Convert switch_mmu_context() to C")
> Oops, sorry for that. I didn't realise that there was other callers to
> switch_mmu_context() than switch_mm_irqs_off().


No worries, the compiled C version looks a lot nicer than the previous 
asm one - and it was a good way to identify whether there still are 
users of KVM on Book3S 32bit out there :)


Alex





Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ