[PATCH] x86/traps: Fix typo in do_entry_CP()

Andrew Cooper posted 1 patch 3 years, 2 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20210928210014.27954-1-andrew.cooper3@citrix.com
xen/arch/x86/traps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] x86/traps: Fix typo in do_entry_CP()
Posted by Andrew Cooper 3 years, 2 months ago
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")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
CC: Bobby Eshleman <bobby.eshleman@gmail.com>
---
 xen/arch/x86/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index c2e2603c394b..63676b0a68ff 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -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 */
-- 
2.11.0


Re: [PATCH] x86/traps: Fix typo in do_entry_CP()
Posted by Jan Beulich 3 years, 2 months ago
On 28.09.2021 23:00, Andrew Cooper wrote:
> 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")
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>


Re: [PATCH] x86/traps: Fix typo in do_entry_CP()
Posted by Andrew Cooper 3 years ago
On 29/09/2021 09:07, Jan Beulich wrote:
> On 28.09.2021 23:00, Andrew Cooper wrote:
>> 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")
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>

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

Re: [PATCH] x86/traps: Fix typo in do_entry_CP()
Posted by Ian Jackson 3 years ago
Andrew Cooper writes ("Re: [PATCH] x86/traps: Fix typo in do_entry_CP()"):
> 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,

Release-Acked-by: Ian Jackson <iwj@xenproject.org>