Re: [patch] kprobes: dont steal interrupts from vm86

From: Prasanna S Panchamukhi
Date: Wed Nov 17 2004 - 08:15:51 EST


Hello,

>
> Prasanna S Panchamukhi wrote:
> >>With kprobes enabled, vm86 doesn't feel
> >>good. The problem is that kprobes steal
> >>the interrupts (mainly int3 I think) from
> >>it for no good reason.
> >If the int3 is not registered through kprobes,
> >kprobes handler does not handle it and it falls through the
> >normal int3 handler AFAIK.
> I was considering this, but I convinced
> myself that checking the VM flag is good
> in any case, because, as I presume, you
> never need the interrupts from v86. Or do
> you?
> If there is a bug in kprobes, it would be
> good to fix either, but I just think it
> will not make my patch completely useless.
>
Yes, there is a small bug in kprobes. Kprobes int3 handler
was returning wrong value. Please check out if the patch
attached with this mail fixes your problem.

Please let me know if you have any issues.

Thanks
Prasanna

--
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<prasanna@xxxxxxxxxx>

This patch fixes the problem reported by Stas Sergeev, that kprobes steals
the virtual-8086 exceptions. This fix modifies kprobe_handler() to return 0 when in
virtual-8086 mode.


---

linux-2.6.10-rc2-prasanna/arch/i386/kernel/kprobes.c | 4 ++++
1 files changed, 4 insertions(+)

diff -puN arch/i386/kernel/kprobes.c~kprobes-vm86-interrupt-miss arch/i386/kernel/kprobes.c
--- linux-2.6.10-rc2/arch/i386/kernel/kprobes.c~kprobes-vm86-interrupt-miss 2004-11-17 18:30:11.000000000 +0530
+++ linux-2.6.10-rc2-prasanna/arch/i386/kernel/kprobes.c 2004-11-17 18:38:20.000000000 +0530
@@ -117,6 +117,10 @@ static inline int kprobe_handler(struct
p = get_kprobe(addr);
if (!p) {
unlock_kprobes();
+ if (regs->eflags & VM_MASK)
+ /*we are in virtual-8086 mode, return 0*/
+ goto no_kprobe;
+
if (*addr != BREAKPOINT_INSTRUCTION) {
/*
* The breakpoint instruction was removed right

_