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: <05bde41f-9f2a-18e9-05ef-c5b29a66caf8@gmail.com>
Date: Tue, 17 Dec 2024 17:38:04 +0100
From: Uros Bizjak <ubizjak@...il.com>
To: David Woodhouse <dwmw2@...radead.org>,
 Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
 x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
 Eric Biederman <ebiederm@...ssion.com>, David Woodhouse <dwmw@...zon.co.uk>,
 Sourabh Jain <sourabhjain@...ux.ibm.com>,
 Hari Bathini <hbathini@...ux.ibm.com>, Michael Ellerman
 <mpe@...erman.id.au>, Thomas Zimmermann <tzimmermann@...e.de>,
 Andrew Morton <akpm@...ux-foundation.org>, Baoquan He <bhe@...hat.com>,
 Yuntao Wang <ytcoode@...il.com>, David Kaplan <david.kaplan@....com>,
 Tao Liu <ltao@...hat.com>,
 "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
 Kai Huang <kai.huang@...el.com>, Ard Biesheuvel <ardb@...nel.org>,
 Josh Poimboeuf <jpoimboe@...nel.org>, Breno Leitao <leitao@...ian.org>,
 Wei Yang <richard.weiyang@...il.com>, Rong Xu <xur@...gle.com>,
 Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
 linux-kernel@...r.kernel.org, kexec@...ts.infradead.org,
 Simon Horman <horms@...nel.org>, Dave Young <dyoung@...hat.com>,
 Peter Zijlstra <peterz@...radead.org>, bsz@...zon.de, nathan@...nel.org
Subject: Re: [PATCH 2/9] x86/kexec: Ensure preserve_context flag is set on
 return to kernel



On 17. 12. 24 00:24, David Woodhouse wrote:
> From: David Woodhouse <dwmw@...zon.co.uk>
> 
> The swap_pages function will only actually *swap*, as its name implies,
> if the preserve_context flag in the %r11 register is non-zero. On the
> way back from a ::preserve_context kexec, ensure that the %r11 register
> is non-zero so that the pages get swapped back.
> 
> Fixes: 9e5683e2d0b5 ("x86/kexec: Only swap pages for ::preserve_context mode")
> Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
> ---
>   arch/x86/kernel/relocate_kernel_64.S | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> index 9bd601dd8659..1a52e4339c1d 100644
> --- a/arch/x86/kernel/relocate_kernel_64.S
> +++ b/arch/x86/kernel/relocate_kernel_64.S
> @@ -220,6 +220,7 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
>   	movq	kexec_pa_table_page(%rip), %rax
>   	movq	%rax, %cr3
>   	lea	PAGE_SIZE(%r8), %rsp
> +	movq	$1, %r11	/* Ensure preserve_context flag is set */

You can save a byte here by using "movl $1, %r11d".

>   	call	swap_pages
>   	movq	kexec_va_control_page(%rip), %rax
>   	addq	$(virtual_mapped - relocate_kernel), %rax

Uros.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ