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: <alpine.DEB.2.21.1809140126050.1473@nanos.tec.linutronix.de>
Date:   Fri, 14 Sep 2018 01:31:05 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Brijesh Singh <brijesh.singh@....com>
cc:     x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        Tom Lendacky <thomas.lendacky@....com>,
        Borislav Petkov <bp@...e.de>, "H. Peter Anvin" <hpa@...or.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Radim Krčmář <rkrcmar@...hat.com>
Subject: Re: [PATCH v8 2/2] x86/kvm: use __bss_decrypted attribute in shared
 variables

On Thu, 13 Sep 2018, Brijesh Singh wrote:
>  
> +static void __init kvmclock_init_mem(void)
> +{
> +	unsigned int ncpus = num_possible_cpus() - HVC_BOOT_ARRAY_SIZE;
> +	unsigned int order = get_order(ncpus * sizeof(*hvclock_mem));
> +	struct page *p;
> +	int r;
> +
> +	p = alloc_pages(GFP_KERNEL, order);
> +	if (p) {

If you make this:

	if (!p) {
		pr_warn();
		return;
	}

then you spare one indentation level and give useful information.

> +		hvclock_mem = page_address(p);
> +
> +		/*
> +		 * hvclock is shared between the guest and the hypervisor, must
> +		 * be mapped decrypted.
> +		 */
> +		if (sev_active()) {
> +			r = set_memory_decrypted((unsigned long) hvclock_mem,
> +						 1UL << order);
> +			if (r) {
> +				__free_pages(p, order);
> +				hvclock_mem = NULL;

This wants a pr_warn() as well, please.
  
> +				return;
> +			}
> +		}
> +
> +		memset(hvclock_mem, 0, PAGE_SIZE << order);
> +	}
> +}

Other than that, this looks really reasonable and way more palatable in the
rc stage.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ