* [PATCH] xen/pv: Fix a boot up hang triggered by int3 self test
@ 2019-07-11 4:47 Zhenzhong Duan
2019-07-12 7:41 ` Zhenzhong Duan
0 siblings, 1 reply; 2+ messages in thread
From: Zhenzhong Duan @ 2019-07-11 4:47 UTC (permalink / raw)
To: linux-kernel
Cc: xen-devel, x86, srinivas.eeda, Zhenzhong Duan, Boris Ostrovsky,
Juergen Gross, Stefano Stabellini, Peter Zijlstra,
Thomas Gleixner, Ingo Molnar, Borislav Petkov
Commit 7457c0da024b ("x86/alternatives: Add int3_emulate_call()
selftest") reveals a bug in XEN PV int3 assemble code. There is
a double pop of register R11 and RCX currupting the exception
frame, one in xen_int3 and the other in xen_xenint3.
We see below hang at bootup:
general protection fault: 0000 [#1] SMP NOPTI
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0+ #6
RIP: e030:int3_magic+0x0/0x7
Call Trace:
alternative_instructions+0x3d/0x12e
check_bugs+0x7c9/0x887
?__get_locked_pte+0x178/0x1f0
start_kernel+0x4ff/0x535
?set_init_arg+0x55/0x55
xen_start_kernel+0x571/0x57a
Fix it by removing xen_xenint3.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
---
arch/x86/include/asm/traps.h | 2 +-
arch/x86/xen/enlighten_pv.c | 2 +-
arch/x86/xen/xen-asm_64.S | 1 -
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 7d6f3f3..f2bd284 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -40,7 +40,7 @@
asmlinkage void xen_divide_error(void);
asmlinkage void xen_xennmi(void);
asmlinkage void xen_xendebug(void);
-asmlinkage void xen_xenint3(void);
+asmlinkage void xen_int3(void);
asmlinkage void xen_overflow(void);
asmlinkage void xen_bounds(void);
asmlinkage void xen_invalid_op(void);
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 4722ba2..2138d69 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -596,7 +596,7 @@ struct trap_array_entry {
static struct trap_array_entry trap_array[] = {
{ debug, xen_xendebug, true },
- { int3, xen_xenint3, true },
+ { int3, xen_int3, true },
{ double_fault, xen_double_fault, true },
#ifdef CONFIG_X86_MCE
{ machine_check, xen_machine_check, true },
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
index 1e9ef0b..ebf610b 100644
--- a/arch/x86/xen/xen-asm_64.S
+++ b/arch/x86/xen/xen-asm_64.S
@@ -32,7 +32,6 @@ xen_pv_trap divide_error
xen_pv_trap debug
xen_pv_trap xendebug
xen_pv_trap int3
-xen_pv_trap xenint3
xen_pv_trap xennmi
xen_pv_trap overflow
xen_pv_trap bounds
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xen/pv: Fix a boot up hang triggered by int3 self test
2019-07-11 4:47 [PATCH] xen/pv: Fix a boot up hang triggered by int3 self test Zhenzhong Duan
@ 2019-07-12 7:41 ` Zhenzhong Duan
0 siblings, 0 replies; 2+ messages in thread
From: Zhenzhong Duan @ 2019-07-12 7:41 UTC (permalink / raw)
To: linux-kernel
Cc: xen-devel, x86, srinivas.eeda, Boris Ostrovsky, Juergen Gross,
Stefano Stabellini, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Borislav Petkov
Sorry for the noise, it looks description is wrong.
This is not a double pop, but xen pv taking the path
with create_gap=0, I'll send a v2.
Zhenzhong
On 2019/7/11 12:47, Zhenzhong Duan wrote:
> Commit 7457c0da024b ("x86/alternatives: Add int3_emulate_call()
> selftest") reveals a bug in XEN PV int3 assemble code. There is
> a double pop of register R11 and RCX currupting the exception
> frame, one in xen_int3 and the other in xen_xenint3.
>
> We see below hang at bootup:
>
> general protection fault: 0000 [#1] SMP NOPTI
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0+ #6
> RIP: e030:int3_magic+0x0/0x7
> Call Trace:
> alternative_instructions+0x3d/0x12e
> check_bugs+0x7c9/0x887
> ?__get_locked_pte+0x178/0x1f0
> start_kernel+0x4ff/0x535
> ?set_init_arg+0x55/0x55
> xen_start_kernel+0x571/0x57a
>
> Fix it by removing xen_xenint3.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> ---
> arch/x86/include/asm/traps.h | 2 +-
> arch/x86/xen/enlighten_pv.c | 2 +-
> arch/x86/xen/xen-asm_64.S | 1 -
> 3 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
> index 7d6f3f3..f2bd284 100644
> --- a/arch/x86/include/asm/traps.h
> +++ b/arch/x86/include/asm/traps.h
> @@ -40,7 +40,7 @@
> asmlinkage void xen_divide_error(void);
> asmlinkage void xen_xennmi(void);
> asmlinkage void xen_xendebug(void);
> -asmlinkage void xen_xenint3(void);
> +asmlinkage void xen_int3(void);
> asmlinkage void xen_overflow(void);
> asmlinkage void xen_bounds(void);
> asmlinkage void xen_invalid_op(void);
> diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
> index 4722ba2..2138d69 100644
> --- a/arch/x86/xen/enlighten_pv.c
> +++ b/arch/x86/xen/enlighten_pv.c
> @@ -596,7 +596,7 @@ struct trap_array_entry {
>
> static struct trap_array_entry trap_array[] = {
> { debug, xen_xendebug, true },
> - { int3, xen_xenint3, true },
> + { int3, xen_int3, true },
> { double_fault, xen_double_fault, true },
> #ifdef CONFIG_X86_MCE
> { machine_check, xen_machine_check, true },
> diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
> index 1e9ef0b..ebf610b 100644
> --- a/arch/x86/xen/xen-asm_64.S
> +++ b/arch/x86/xen/xen-asm_64.S
> @@ -32,7 +32,6 @@ xen_pv_trap divide_error
> xen_pv_trap debug
> xen_pv_trap xendebug
> xen_pv_trap int3
> -xen_pv_trap xenint3
> xen_pv_trap xennmi
> xen_pv_trap overflow
> xen_pv_trap bounds
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-12 7:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 4:47 [PATCH] xen/pv: Fix a boot up hang triggered by int3 self test Zhenzhong Duan
2019-07-12 7:41 ` Zhenzhong Duan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).