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]
Date:   Thu, 4 Nov 2021 10:26:56 -0500
From:   Brijesh Singh <brijesh.singh@....com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     brijesh.singh@....com, x86@...nel.org,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        linux-efi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        linux-coco@...ts.linux.dev, linux-mm@...ck.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Joerg Roedel <jroedel@...e.de>,
        Tom Lendacky <thomas.lendacky@....com>,
        "H. Peter Anvin" <hpa@...or.com>, Ard Biesheuvel <ardb@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Jim Mattson <jmattson@...gle.com>,
        Andy Lutomirski <luto@...nel.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Sergio Lopez <slp@...hat.com>, Peter Gonda <pgonda@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        David Rientjes <rientjes@...gle.com>,
        Dov Murik <dovmurik@...ux.ibm.com>,
        Tobin Feldman-Fitzthum <tobin@....com>,
        Michael Roth <michael.roth@....com>,
        Vlastimil Babka <vbabka@...e.cz>,
        "Kirill A . Shutemov" <kirill@...temov.name>,
        Andi Kleen <ak@...ux.intel.com>,
        "Dr . David Alan Gilbert" <dgilbert@...hat.com>,
        tony.luck@...el.com, marcorr@...gle.com,
        sathyanarayanan.kuppuswamy@...ux.intel.com
Subject: Re: [PATCH v6 14/42] x86/sev: Register GHCB memory when SEV-SNP is
 active



On 11/4/21 8:58 AM, Borislav Petkov wrote:
> On Wed, Nov 03, 2021 at 03:10:16PM -0500, Brijesh Singh wrote:
>> Looking at the secondary CPU bring up path it seems that we will not be
>> getting #VC until the early_setup_idt() is called. I am thinking to add
>> function to register the GHCB from the early_setup_idt()
>>
>> early_setup_idt()
>> {
>>    ...
>>    if (IS_ENABLED(CONFIG_MEM_ENCRYPT))
>>      sev_snp_register_ghcb()
>>    ...
>> }
>>
>> The above will cover the APs
> 
> That will cover the APs during early boot as that is being called from
> asm.
> 
>> and for BSP case I can call the same function just after the final IDT
>> is loaded
> 
> Why after and not before?
> 

I just looked at load_current_idt() and we should not get #VC before 
loading the new idt, so, its safe to do is before.


>> cpu_init_exception_handling()
>> {
>>     ...
>>     ...
>>     /* Finally load the IDT */
>>     load_current_idt();
>>
>>     if (IS_ENABLED(CONFIG_MEM_ENCRYPT))
>>       sev_snp_register_ghcb()
>>
>> }
> 
> That is also called on the APs - not only the BSP. trap_init() calls it
> from start_kernel() which is the BSP and cpu_init_secondary() calls it
> too, which is ofc the APs.
> 
> I guess that should be ok since you're calling the same function from
> both but WTH do I know...
> 

For AP case, we will be registering the same GHCB GPA twice, that should 
not be an issue. The GHCB spec does not restrict us on registering the 
GPA twice.

Of course, the current patch does not suffer with it. Let me know your 
preference.

thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ