All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vamsi Krishna S ." <vamsi@in.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Linux-Kernel ML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] (re-xmit): kprobes for i386
Date: Wed, 21 Aug 2002 18:03:33 +0530	[thread overview]
Message-ID: <20020821180333.A1227@in.ibm.com> (raw)
In-Reply-To: <20020821055103.121A62C05E@lists.samba.org>; from rusty@rustcorp.com.au on Wed, Aug 21, 2002 at 08:48:44PM +1000

Hi Rusty,

On Wed, Aug 21, 2002 at 08:48:44PM +1000, Rusty Russell wrote:
> In message <20020821140155.A987@in.ibm.com> you write:
> > No. Don't do this. When a trap occurs in kernel space, the
> 
> Sorry Vamsi: I'll have more faith in your code next time, I promise.
> 
Thanks :-). But, I think you forgot to apply my incremental patch. 
Here it is:

Thanks again,
Vamsi.
-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: vamsi@in.ibm.com
--
diff -u 31-dp/arch/i386/kernel/entry.S 31-dp/arch/i386/kernel/entry.S
--- 31-dp/arch/i386/kernel/entry.S	2002-08-21 11:20:18.000000000 +0530
+++ 31-dp/arch/i386/kernel/entry.S	2002-08-21 12:10:30.000000000 +0530
@@ -430,7 +430,7 @@
 	jmp ret_from_exception
 
 ENTRY(debug)
-	pushl %eax
+	pushl $-1			# mark this as an int
 	SAVE_ALL
 	movl %esp,%edx
 	pushl $0
@@ -452,7 +452,7 @@
 	RESTORE_ALL
 
 ENTRY(int3)
-	pushl %eax
+	pushl $-1			# mark this as an int
 	SAVE_ALL
 	movl %esp,%edx
 	pushl $0
diff -u 31-dp/arch/i386/kernel/kprobes.c 31-dp/arch/i386/kernel/kprobes.c
--- 31-dp/arch/i386/kernel/kprobes.c	2002-08-21 11:20:18.000000000 +0530
+++ 31-dp/arch/i386/kernel/kprobes.c	2002-08-21 12:09:50.000000000 +0530
@@ -117,11 +117,12 @@
 	/*
 	 * We singlestepped with interrupts disabled. So, the result on
 	 * the stack would be incorrect for "pushfl" instruction.
+	 * Note that regs->esp is actually the top of the stack when the
+	 * trap occurs in kernel space.
 	 */
 	if (current_kprobe->opcode == 0x9c) { /* pushfl */
-		unsigned long *stacktop = (unsigned long *)regs->esp;
-		*stacktop &= ~(TF_MASK | IF_MASK);
-		*stacktop |= kprobe_old_eflags;
+		regs->esp &= ~(TF_MASK | IF_MASK);
+		regs->esp |= kprobe_old_eflags;
 	}
 
 	rearm_kprobe(current_kprobe, regs);
diff -u 31-dp/include/linux/kprobes.h 31-dp/include/linux/kprobes.h
--- 31-dp/include/linux/kprobes.h	2002-08-21 11:20:18.000000000 +0530
+++ 31-dp/include/linux/kprobes.h	2002-08-21 12:30:24.000000000 +0530
@@ -2,6 +2,8 @@
 #define _LINUX_KPROBES_H
 #include <linux/config.h>
 #include <linux/list.h>
+#include <linux/notifier.h>
+#include <linux/smp.h>
 #include <asm/kprobes.h>
 
 struct kprobe;

  reply	other threads:[~2002-08-21 12:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-20  4:39 [PATCH] (re-xmit): kprobes for i386 Rusty Russell
2002-08-20  8:19 ` Christoph Hellwig
2002-08-20 10:25   ` Rusty Russell
2002-08-20 11:54 ` Luca Barbieri
     [not found]   ` <3D62365E.8030905@iram.es>
2002-08-20 14:06     ` Luca Barbieri
2002-08-20 19:29   ` Linus Torvalds
2002-08-21  1:03   ` Rusty Russell
2002-08-21  1:29     ` Luca Barbieri
2002-08-21  4:21       ` Rusty Russell
2002-08-21  8:31     ` Vamsi Krishna S .
2002-08-21 10:48       ` Rusty Russell
2002-08-21 12:33         ` Vamsi Krishna S . [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-09-20  6:16 [PATCH] Re-xmit: " Rusty Russell
2002-08-12  8:18 [PATCH] (Re-xmit) " Rusty Russell

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=20020821180333.A1227@in.ibm.com \
    --to=vamsi@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.com \
    /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.