[PATCH] PPC64 Clear MSR_RI earlier in syscall exit path

From: Paul Mackerras
Date: Fri Jan 21 2005 - 23:15:30 EST


This patch is from Craig Chaney <cchaney@xxxxxxxxxx>.

This patch moves the restoring of the stack pointer in the system call
exit path to after the point where we clear the RI (recoverable
interrupt) bit in the MSR. Normally, loading the stack pointer before
clearing RI doesn't cause any problem because there is no trap that
can normally occur in between. But if we are tracing the code using a
tool that single-steps instructions, this can cause a problem. In
this case, clearing RI serves as an indication that the following code
can't be safely single-stepped.

Signed-off-by: Craig Chaney <cchaney@xxxxxxxxxx>
Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>

diff -Naur clean/arch/ppc64/kernel/entry.S edited/arch/ppc64/kernel/entry.S
--- clean/arch/ppc64/kernel/entry.S 2004-09-26 14:24:27.000000000 +0000
+++ edited/arch/ppc64/kernel/entry.S 2004-09-27 14:36:29.221308744 +0000
@@ -185,10 +185,10 @@
beq- 1f /* only restore r13 if */
ld r13,GPR13(r1) /* returning to usermode */
1: ld r2,GPR2(r1)
- ld r1,GPR1(r1)
li r12,MSR_RI
andc r10,r10,r12
mtmsrd r10,1 /* clear MSR.RI */
+ ld r1,GPR1(r1)
mtlr r4
mtcr r5
mtspr SRR0,r7
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/