diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/kprobes.c | 13 | ||||
-rw-r--r-- | arch/ia64/kernel/kprobes.c | 7 | ||||
-rw-r--r-- | arch/powerpc/kernel/kprobes.c | 12 | ||||
-rw-r--r-- | arch/sparc64/kernel/kprobes.c | 8 | ||||
-rw-r--r-- | arch/x86_64/kernel/kprobes.c | 9 |
5 files changed, 49 insertions, 0 deletions
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 2f372dbd34fd..6483eeb1a4e8 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -188,6 +188,19 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
188 | kcb->kprobe_status = KPROBE_REENTER; | 188 | kcb->kprobe_status = KPROBE_REENTER; |
189 | return 1; | 189 | return 1; |
190 | } else { | 190 | } else { |
191 | if (regs->eflags & VM_MASK) { | ||
192 | /* We are in virtual-8086 mode. Return 0 */ | ||
193 | goto no_kprobe; | ||
194 | } | ||
195 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
196 | /* The breakpoint instruction was removed by | ||
197 | * another cpu right after we hit, no further | ||
198 | * handling of this interrupt is appropriate | ||
199 | */ | ||
200 | regs->eip -= sizeof(kprobe_opcode_t); | ||
201 | ret = 1; | ||
202 | goto no_kprobe; | ||
203 | } | ||
191 | p = __get_cpu_var(current_kprobe); | 204 | p = __get_cpu_var(current_kprobe); |
192 | if (p->break_handler && p->break_handler(p, regs)) { | 205 | if (p->break_handler && p->break_handler(p, regs)) { |
193 | goto ss_probe; | 206 | goto ss_probe; |
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 4de7f6759093..346fedf9ea47 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -638,6 +638,13 @@ static int __kprobes pre_kprobes_handler(struct die_args *args) | |||
638 | if (p->break_handler && p->break_handler(p, regs)) { | 638 | if (p->break_handler && p->break_handler(p, regs)) { |
639 | goto ss_probe; | 639 | goto ss_probe; |
640 | } | 640 | } |
641 | } else if (!is_ia64_break_inst(regs)) { | ||
642 | /* The breakpoint instruction was removed by | ||
643 | * another cpu right after we hit, no further | ||
644 | * handling of this interrupt is appropriate | ||
645 | */ | ||
646 | ret = 1; | ||
647 | goto no_kprobe; | ||
641 | } else { | 648 | } else { |
642 | /* Not our break */ | 649 | /* Not our break */ |
643 | goto no_kprobe; | 650 | goto no_kprobe; |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 27b0c40601fb..cfab48566db1 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -179,6 +179,18 @@ static inline int kprobe_handler(struct pt_regs *regs) | |||
179 | kcb->kprobe_status = KPROBE_REENTER; | 179 | kcb->kprobe_status = KPROBE_REENTER; |
180 | return 1; | 180 | return 1; |
181 | } else { | 181 | } else { |
182 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
183 | /* If trap variant, then it belongs not to us */ | ||
184 | kprobe_opcode_t cur_insn = *addr; | ||
185 | if (is_trap(cur_insn)) | ||
186 | goto no_kprobe; | ||
187 | /* The breakpoint instruction was removed by | ||
188 | * another cpu right after we hit, no further | ||
189 | * handling of this interrupt is appropriate | ||
190 | */ | ||
191 | ret = 1; | ||
192 | goto no_kprobe; | ||
193 | } | ||
182 | p = __get_cpu_var(current_kprobe); | 194 | p = __get_cpu_var(current_kprobe); |
183 | if (p->break_handler && p->break_handler(p, regs)) { | 195 | if (p->break_handler && p->break_handler(p, regs)) { |
184 | goto ss_probe; | 196 | goto ss_probe; |
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index ff5e9d5cad50..b9a9ce70e55c 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -135,6 +135,14 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
135 | prepare_singlestep(p, regs, kcb); | 135 | prepare_singlestep(p, regs, kcb); |
136 | return 1; | 136 | return 1; |
137 | } else { | 137 | } else { |
138 | if (*(u32 *)addr != BREAKPOINT_INSTRUCTION) { | ||
139 | /* The breakpoint instruction was removed by | ||
140 | * another cpu right after we hit, no further | ||
141 | * handling of this interrupt is appropriate | ||
142 | */ | ||
143 | ret = 1; | ||
144 | goto no_kprobe; | ||
145 | } | ||
138 | p = __get_cpu_var(current_kprobe); | 146 | p = __get_cpu_var(current_kprobe); |
139 | if (p->break_handler && p->break_handler(p, regs)) | 147 | if (p->break_handler && p->break_handler(p, regs)) |
140 | goto ss_probe; | 148 | goto ss_probe; |
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index b7dc1f816d13..8b866a8572cf 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -334,6 +334,15 @@ int __kprobes kprobe_handler(struct pt_regs *regs) | |||
334 | return 1; | 334 | return 1; |
335 | } | 335 | } |
336 | } else { | 336 | } else { |
337 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
338 | /* The breakpoint instruction was removed by | ||
339 | * another cpu right after we hit, no further | ||
340 | * handling of this interrupt is appropriate | ||
341 | */ | ||
342 | regs->rip = (unsigned long)addr; | ||
343 | ret = 1; | ||
344 | goto no_kprobe; | ||
345 | } | ||
337 | p = __get_cpu_var(current_kprobe); | 346 | p = __get_cpu_var(current_kprobe); |
338 | if (p->break_handler && p->break_handler(p, regs)) { | 347 | if (p->break_handler && p->break_handler(p, regs)) { |
339 | goto ss_probe; | 348 | goto ss_probe; |