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:   Wed, 15 Feb 2023 01:53:19 +0000
From:   "Huang, Kai" <kai.huang@...el.com>
To:     "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "Hansen, Dave" <dave.hansen@...el.com>,
        "bp@...en8.de" <bp@...en8.de>
CC:     "sathyanarayanan.kuppuswamy@...ux.intel.com" 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>,
        "kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Yamahata, Isaku" <isaku.yamahata@...el.com>,
        "x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH 2/2] x86/tdx: Convert shared memory back to private on
 kexec


> +void tdx_kexec_prepare(bool crash)
> +{
> +	/*
> +	 * Crash kernel may want to see data in the shared buffers.
> +	 * Do not revert them to private on kexec of crash kernel.
> +	 */
> +	if (crash)
> +		return;
> +
> +	/*
> +	 * Walk direct mapping and convert all shared memory back to private,
> +	 * so the target kernel will be able use it normally.
> +	 */
> +	mmap_write_lock(&init_mm);
> +	walk_page_range_novma(&init_mm,
> +			      PAGE_OFFSET,
> +			      PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT),
> +			      &unshare_ops, init_mm.pgd, NULL);
> +	mmap_write_unlock(&init_mm);
> +}

Looks the page table walk is done unconditionally when !crash.

I think it's better to check whether this is TDX guest (either this function, or
below in machine_kexec()) and just return early if it's not a TDX guest?

[..]


>  /*
> @@ -312,6 +313,7 @@ void machine_kexec(struct kimage *image)
>  	local_irq_disable();
>  	hw_breakpoint_disable();
>  	cet_disable();
> +	tdx_kexec_prepare(image->type == KEXEC_TYPE_CRASH);
>  
>  	if (image->preserve_context) {
>  #ifdef CONFIG_X86_IO_APIC

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ