Skip to contentSkip to conversation

x86/traps: Fix typo in do_entry_CP()

PATCH In review Andrew Cooper 3 participants 4 messages Sep 28, 2021 – Nov 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/traps: Fix typo in do_entry_CP()

The call to debugger_trap_entry() should pass the correct vector. The break-for-gdbsx logic is in practice unreachable because PV guests can't generate #CP, but it will interfere with anyone inserting custom debugging into debugger_trap_entry().

Fixes 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Bobby Eshleman <[email protected]>

---
 xen/arch/x86/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/traps.c +1 -1
index c2e2603c394b..63676b0a68ff 100644
@@ -2047,7 +2047,7 @@ void do_entry_CP(struct cpu_user_regs *regs)
     const char *err = "??";
     unsigned int ec = regs->error_code;
 
-    if ( debugger_trap_entry(TRAP_debug, regs) )
+    if ( debugger_trap_entry(X86_EXC_CP, regs) )
         return;
 
     /* Decode ec if possible */
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Andrew Cooper

The call to debugger_trap_entry() should pass the correct vector. The break-for-gdbsx logic is in practice unreachable because PV guests can't generate #CP, but it will interfere with anyone inserting custom debugging into debugger_trap_entry().

Fixes 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")
#2 lore raw
Quoted 10 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper

The call to debugger_trap_entry() should pass the correct vector. The break-for-gdbsx logic is in practice unreachable because PV guests can't generate #CP, but it will interfere with anyone inserting custom debugging into debugger_trap_entry().

Fixes 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")

It turns out that I forgot to commit this patch, and it now needs a Release Ack to go in.

It is very safe and obvious.  It is passing the wrong constant into a debug function.

Luckily the impact is benign due to other properties of the logic, and would only cause problems for people adding manual debug logic.

~Andrew

#3 lore raw

Andrew Cooper writes ("Re: [PATCH] x86/traps: Fix typo in do_entry_CP()"):

Quoted 8 lines

It turns out that I forgot to commit this patch, and it now needs a Release Ack to go in.

It is very safe and obvious.  It is passing the wrong constant into a debug function.

Luckily the impact is benign due to other properties of the logic, and would only cause problems for people adding manual debug logic.

Thanks,