x86: show correct code in CPU state
PATCH 1/1 x86: show correct code in CPU state
When showing the CPU state (e.g., after a crash) the dump of code around RIP is incorrect.
Incorrect:
Xen code around <ffff82d0801113cf> (...):
00 c6 c1 ee 08 48 c1 e0 <04> 03 04 f1 8b ...
^^ Uninitialized ^^ Missing 0x48Correct:
Xen code around <ffff82d0801113cf> (...):
c6 c1 ee 08 48 c1 e0 04 <48> 03 04 f1 8b ...When coping the bytes before RIP, the destination was off-by-one.
--- xen/arch/x86/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/traps.c +1 -1
@@ -150,7 +150,7 @@ static void show_code(const struct cpu_user_regs *regs) : "=&c" (missing_before), "=&D" (tmp), "=&S" (tmp) : "0" (ARRAY_SIZE(insns_before)), -"1" (insns_before +ARRAY_SIZE (insns_before)), +"1" (insns_before +ARRAY_SIZE (insns_before) -1 ), "2" (regs->rip - 1));clac ();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 9 lines · David Vrabel
When showing the CPU state (e.g., after a crash) the dump of code around RIP is incorrect.
Incorrect:
Xen code around <ffff82d0801113cf> (...): 00 c6 c1 ee 08 48 c1 e0 <04> 03 04 f1 8b ... ^^ Uninitialized ^^ Missing 0x48
Quoted 8 lines
Correct:
Xen code around <ffff82d0801113cf> (...): c6 c1 ee 08 48 c1 e0 04 <48> 03 04 f1 8b ...When coping the bytes before RIP, the destination was off-by-one.
Signed-off-by David Vrabel <[email protected]>
CC'ing Wei for release ack.
Quoted 9 lines
--- xen/arch/x86/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/traps.c +0
-0
xen/arch/x86/traps.c static void show_code(const struct cpu_user_regs *regs) · line 156
Quoted 8 lines
xen/arch/x86/traps.c +1
-1@@ -150,7 +150,7 @@ static void show_code(const struct cpu_user_regs *regs) : "=&c" (missing_before), "=&D" (tmp), "=&S" (tmp) : "0" (ARRAY_SIZE(insns_before)), -"1" (insns_before +ARRAY_SIZE (insns_before)), +"1" (insns_before +ARRAY_SIZE (insns_before) -1 ), "2" (regs->rip - 1));clac ();
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 15 lines · Andrew Cooper
Quoted 14 lines · David Vrabel
When showing the CPU state (e.g., after a crash) the dump of code around RIP is incorrect.
Incorrect:
Xen code around <ffff82d0801113cf> (...): 00 c6 c1 ee 08 48 c1 e0 <04> 03 04 f1 8b ... ^^ Uninitialized ^^ Missing 0x48Correct:
Xen code around <ffff82d0801113cf> (...): c6 c1 ee 08 48 c1 e0 04 <48> 03 04 f1 8b ...
Quoted 7 lines
Quoted 3 lines
When coping the bytes before RIP, the destination was off-by-one.
Signed-off-by David Vrabel <[email protected]>Reviewed-by Andrew Cooper <[email protected]>CC'ing Wei for release ack.
Quoted 5 lines
Quoted 5 lines
--- xen/arch/x86/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
xen/arch/x86/traps.c static void show_code(const struct cpu_user_regs *regs) · line 156
Quoted 13 lines
xen/arch/x86/traps.c +1
-1@@ -150,7 +150,7 @@ static void show_code(const struct cpu_user_regs *regs) : "=&c" (missing_before), "=&D" (tmp), "=&S" (tmp) : "0" (ARRAY_SIZE(insns_before)), -"1" (insns_before +ARRAY_SIZE (insns_before)), +"1" (insns_before +ARRAY_SIZE (insns_before) -1 ), "2" (regs->rip - 1));clac ();
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel