aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib/sstep.c
diff options
context:
space:
mode:
authorGui,Jian <guij@cn.ibm.com>2006-10-31 21:50:15 -0500
committerPaul Mackerras <paulus@samba.org>2006-10-31 23:14:12 -0500
commit0d69a052d4d7c4085706b9ac0d1bd28ff90c9fca (patch)
tree8dada42c1c58e9450161e88e67d304c68917f3a8 /arch/powerpc/lib/sstep.c
parent292f86f005e3867277b2126c2399eea3e773a4fc (diff)
[POWERPC] Disallow kprobes on emulate_step and branch_taken
On powerpc, probing on emulate_step function will crash 2.6.18.1 when it is triggered. When kprobe is triggered, emulate_step() is on its kernel path and will cause recursive kprobe fault. And branch_taken() is called in emulate_step(). This disallows kprobes on both of them. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/lib/sstep.c')
-rw-r--r--arch/powerpc/lib/sstep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 9590ba780b98..7e8ded051b5b 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -9,6 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/kprobes.h>
12#include <linux/ptrace.h> 13#include <linux/ptrace.h>
13#include <asm/sstep.h> 14#include <asm/sstep.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
@@ -25,7 +26,7 @@ extern char system_call_common[];
25/* 26/*
26 * Determine whether a conditional branch instruction would branch. 27 * Determine whether a conditional branch instruction would branch.
27 */ 28 */
28static int branch_taken(unsigned int instr, struct pt_regs *regs) 29static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
29{ 30{
30 unsigned int bo = (instr >> 21) & 0x1f; 31 unsigned int bo = (instr >> 21) & 0x1f;
31 unsigned int bi; 32 unsigned int bi;
@@ -51,7 +52,7 @@ static int branch_taken(unsigned int instr, struct pt_regs *regs)
51 * or -1 if the instruction is one that should not be stepped, 52 * or -1 if the instruction is one that should not be stepped,
52 * such as an rfid, or a mtmsrd that would clear MSR_RI. 53 * such as an rfid, or a mtmsrd that would clear MSR_RI.
53 */ 54 */
54int emulate_step(struct pt_regs *regs, unsigned int instr) 55int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
55{ 56{
56 unsigned int opcode, rd; 57 unsigned int opcode, rd;
57 unsigned long int imm; 58 unsigned long int imm;