All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@aknet.ru>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: [patch] kprobes: dont steal interrupts from vm86
Date: Tue, 09 Nov 2004 22:01:46 +0300	[thread overview]
Message-ID: <4191141A.5090202@aknet.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

Hello.

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.
The attached patch fixes the problem by
checking the VM flag where it makes sense.

Andrew, can this please be applied?

Signed-off-by: Stas Sergeev <stsp@aknet.ru>


[-- Attachment #2: kprb_vm86.diff --]
[-- Type: text/x-patch, Size: 2468 bytes --]

--- linux-2.6.10-rc1/arch/i386/kernel/traps.c	2004-11-09 12:59:20.000000000 +0300
+++ linux-2.6.10-rc1-kprb/linux/arch/i386/kernel/traps.c	2004-11-09 13:35:18.625427704 +0300
@@ -408,7 +408,8 @@
 #define DO_ERROR(trapnr, signr, str, name) \
 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
-	if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
+	if (!(regs->eflags & VM_MASK) && \
+		notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
 						== NOTIFY_STOP) \
 		return; \
 	do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \
@@ -422,7 +423,8 @@
 	info.si_errno = 0; \
 	info.si_code = sicode; \
 	info.si_addr = (void __user *)siaddr; \
-	if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
+	if (!(regs->eflags & VM_MASK) && \
+		notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
 						== NOTIFY_STOP) \
 		return; \
 	do_trap(trapnr, signr, str, 0, regs, error_code, &info); \
@@ -431,7 +433,8 @@
 #define DO_VM86_ERROR(trapnr, signr, str, name) \
 asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 { \
-	if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
+	if (!(regs->eflags & VM_MASK) && \
+		notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
 						== NOTIFY_STOP) \
 		return; \
 	do_trap(trapnr, signr, str, 1, regs, error_code, NULL); \
@@ -445,7 +448,8 @@
 	info.si_errno = 0; \
 	info.si_code = sicode; \
 	info.si_addr = (void __user *)siaddr; \
-	if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
+	if (!(regs->eflags & VM_MASK) && \
+		notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
 						== NOTIFY_STOP) \
 		return; \
 	do_trap(trapnr, signr, str, 1, regs, error_code, &info); \
@@ -652,7 +656,8 @@
 #ifdef CONFIG_KPROBES
 asmlinkage int do_int3(struct pt_regs *regs, long error_code)
 {
-	if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
+	if (!(regs->eflags & VM_MASK) &&
+		notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
 			== NOTIFY_STOP)
 		return 1;
 	/* This is an interrupt gate, because kprobes wants interrupts
@@ -693,7 +698,8 @@
 
 	__asm__ __volatile__("movl %%db6,%0" : "=r" (condition));
 
-	if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
+	if (!(regs->eflags & VM_MASK) && 
+		notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
 					SIGTRAP) == NOTIFY_STOP)
 		return;
 	/* It's safe to allow irq's after DR6 has been saved */

             reply	other threads:[~2004-11-09 19:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-09 19:01 Stas Sergeev [this message]
     [not found] <20041109130407.6d7faf10.akpm@osdl.org>
2004-11-10 10:49 ` [patch] kprobes: dont steal interrupts from vm86 Prasanna S Panchamukhi
2004-11-10 18:53   ` Stas Sergeev
2004-11-17 13:15     ` Prasanna S Panchamukhi
2004-11-18 14:55       ` Stas Sergeev
2004-12-02 19:28       ` Stas Sergeev
2004-12-06 15:28         ` Prasanna S Panchamukhi
2004-12-04 18:09       ` Stas Sergeev
2004-12-07  5:53         ` Prasanna S Panchamukhi
2004-12-07 18:44           ` Stas Sergeev
2004-12-09 12:47             ` Prasanna S Panchamukhi
2004-12-09 19:28               ` Stas Sergeev
2005-01-07 11:37                 ` Prasanna S Panchamukhi
2005-01-07 12:59                   ` Andi Kleen
2005-01-13  8:10                     ` Prasanna S Panchamukhi
2005-01-07 22:44                   ` Stas Sergeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4191141A.5090202@aknet.ru \
    --to=stsp@aknet.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.