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:   Mon, 29 Jan 2018 21:00:09 +0800
From:   Baoquan He <bhe@...hat.com>
To:     "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc:     Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        "H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/kexec: Make kexec work in 5-level paging mode

On 01/29/18 at 07:19pm, Baoquan He wrote:
> On 01/29/18 at 02:08pm, Kirill A. Shutemov wrote:
> > I've missed that we need to change relocate_kernel() to set CR4.LA57
> > flag if the kernel has 5-level paging enabled.
> > 
> > I avoided to use ifdef CONFIG_X86_5LEVEL here and inferred if we need to
> > enabled 5-level paging from previous CR4 value. This way the code is
> > ready for boot-time switching between paging modes.
> > 
> > Fixes: 77ef56e4f0fb ("x86: Enable 5-level paging support via CONFIG_X86_5LEVEL=y")
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> > Reported-by: Baoquan He <bhe@...hat.com>
> 
> Thanks, Kirill.
> 
> Tested on qemu with la57 support, kexec works well. Kdump kernel can
> boot into kernel, while there's a memory allocation failure during
> boot which I am trying to fix. The reason is kdump kernel need reserve
> as small memory as possible. Will post soon.

By the way, the kdump failure can be worked around by increasing
crashkernel memory, then kdump kernel can still work well. So this patch
is necessary fix for kexec/kdump.

> 
> For this patch, feel free to add my Tested-by.
> 
> Tested-by: Baoquan He <bhe@...hat.com>
> 
> Thanks
> Baoquan
> > ---
> >  arch/x86/kernel/relocate_kernel_64.S | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> > index 307d3bac5f04..11eda21eb697 100644
> > --- a/arch/x86/kernel/relocate_kernel_64.S
> > +++ b/arch/x86/kernel/relocate_kernel_64.S
> > @@ -68,6 +68,9 @@ relocate_kernel:
> >  	movq	%cr4, %rax
> >  	movq	%rax, CR4(%r11)
> >  
> > +	/* Save CR4. Required to enable the right paging mode later. */
> > +	movq	%rax, %r13
> > +
> >  	/* zero out flags, and disable interrupts */
> >  	pushq $0
> >  	popfq
> > @@ -126,8 +129,13 @@ identity_mapped:
> >  	/*
> >  	 * Set cr4 to a known state:
> >  	 *  - physical address extension enabled
> > +	 *  - 5-level paging, if it was enabled before
> >  	 */
> >  	movl	$X86_CR4_PAE, %eax
> > +	testq	$X86_CR4_LA57, %r13
> > +	jz	1f
> > +	orl	$X86_CR4_LA57, %eax
> > +1:
> >  	movq	%rax, %cr4
> >  
> >  	jmp 1f
> > -- 
> > 2.15.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ