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: <20171017162303.4vekeemfz7ix2cjg@pd.tnic>
Date:   Tue, 17 Oct 2017 18:23:04 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Brijesh Singh <brijesh.singh@....com>,
        Paolo Bonzini <pbonzini@...hat.com>
Cc:     x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Radim Krčmář <rkrcmar@...hat.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [Part1 PATCH v6 16/17] X86/KVM: Decrypt shared per-cpu variables
 when SEV is active

On Tue, Oct 17, 2017 at 10:42:45AM -0500, Brijesh Singh wrote:
> OK, this goes back to your initial feedback during RFC v3 where I tried
> to do similar thing. But since sev_map_percpu_data() uses __init
> functions hence we need to mark the kvm_guest_cpu_init() as __ref but
> you didn't like the idea and asked me to call the sev_map_percpu_data
> from kvm_smp_prepare_boot_cpu() which is already __init.

So looking at this more, I'm wondering how did I miss this: this whole
SEV code doesn't belong in kvm.c but in svm.c! This is AMD-only and
should be there.

Now, for that you need those three percpu variables to not be static but
I think we can do this by adding their declarations to a kvm-internal.h
header which is in arch/x86/kernel/kvm-internal.h, i.e., not in the
include path and only kvm-related units can include it.

@Paolo: thoughts?

Then, you can call sev_map_percpu_data() during module init, i.e.,
svm_init(). Or in one of the init functions you're adding later,
sev_hardware_setup() for example, or so. I.e., one of those init paths.
Because, AFAICT, you want to clear the physical C-bit only once in the
percpu pages.

I think this is much better than the "grafted" situation now.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ