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: <20250815104601.GDaJ8P6efRLzRTD-2i@fat_crate.local>
Date: Fri, 15 Aug 2025 12:46:01 +0200
From: Borislav Petkov <bp@...en8.de>
To: Kai Huang <kai.huang@...el.com>
Cc: dave.hansen@...el.com, tglx@...utronix.de, peterz@...radead.org,
	mingo@...hat.com, hpa@...or.com, thomas.lendacky@....com,
	x86@...nel.org, kas@...nel.org, rick.p.edgecombe@...el.com,
	dwmw@...zon.co.uk, linux-kernel@...r.kernel.org,
	pbonzini@...hat.com, seanjc@...gle.com, kvm@...r.kernel.org,
	reinette.chatre@...el.com, isaku.yamahata@...el.com,
	dan.j.williams@...el.com, ashish.kalra@....com,
	nik.borisov@...e.com, chao.gao@...el.com, sagis@...gle.com,
	farrah.chen@...el.com
Subject: Re: [PATCH v6 1/7] x86/kexec: Consolidate relocate_kernel() function
 parameters

On Thu, Aug 14, 2025 at 11:59:01AM +1200, Kai Huang wrote:
> During kexec, the kernel jumps to the new kernel in relocate_kernel(),
> which is implemented in assembly and both 32-bit and 64-bit have their
> own version.
> 
> Currently, for both 32-bit and 64-bit, the last two parameters of the
> relocate_kernel() are both 'unsigned int' but actually they only convey
> a boolean, i.e., one bit information.  The 'unsigned int' has enough
> space to carry two bits information therefore there's no need to pass
> the two booleans in two separate 'unsigned int'.
> 
> Consolidate the last two function parameters of relocate_kernel() into a
> single 'unsigned int' and pass flags instead.
> 
> Only consolidate the 64-bit version albeit the similar optimization can
> be done for the 32-bit version too.  Don't bother changing the 32-bit
> version while it is working (since assembly code change is required).
> 
> Signed-off-by: Kai Huang <kai.huang@...el.com>
> Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
> ---
> 
>  v5 -> v6:
>   - Add Tom's RB.
> 
>  v4 -> v5:
>   - RELOC_KERNEL_HOST_MEM_ACTIVE -> RELOC_KERNEL_HOST_MEM_ENC_ACTIVE
>     (Tom)
>   - Add a comment to explain only RELOC_KERNEL_PRESERVE_CONTEXT is
>     restored after jumping back from peer kernel for preserved_context
>     kexec (pointed out by Tom).
>   - Use testb instead of testq when comparing the flag with R11 to save
>     3 bytes (Hpa).
> 
>  v4:
>   - new patch
> 
> 
> ---
>  arch/x86/include/asm/kexec.h         | 12 ++++++++++--
>  arch/x86/kernel/machine_kexec_64.c   | 22 +++++++++++++---------
>  arch/x86/kernel/relocate_kernel_64.S | 25 +++++++++++++++----------
>  3 files changed, 38 insertions(+), 21 deletions(-)

Reviewed-by: Borislav Petkov (AMD) <bp@...en8.de>

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ