public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com>
To: akpm@osdl.org
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Linux IA64 <linux-ia64@vger.kernel.org>
Subject: [patch][ia64]Refuse kprobe on ivt code
Date: Fri, 24 Jun 2005 00:28:33 +0000	[thread overview]
Message-ID: <20050623172832.B26121@unix-os.sc.intel.com> (raw)


Subject: Refuse kprobe insert on IVT code

Not safe to insert kprobes on IVT code.

This patch checks to see if the address on which Kprobes is being
inserted is  in ivt code and if it is in ivt code then
refuse to register kprobe.

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>

======================= arch/ia64/kernel/kprobes.c |   13 +++++++++++++
 1 files changed, 13 insertions(+)

Index: linux-2.6.12-mm1/arch/ia64/kernel/kprobes.c
=================================--- linux-2.6.12-mm1.orig/arch/ia64/kernel/kprobes.c
+++ linux-2.6.12-mm1/arch/ia64/kernel/kprobes.c
@@ -263,6 +263,13 @@ static inline void get_kprobe_inst(bundl
 	}
 }
 
+/* Returns non-zero if the PC is in the Interrupt Vector Table */
+static inline int in_ivt_code(unsigned long pc)
+{
+	extern char ia64_ivt[];
+	return (pc >= (u_long)ia64_ivt && pc < (u_long)ia64_ivt+32768);
+}
+
 static int valid_kprobe_addr(int template, int slot, unsigned long addr)
 {
 	if ((slot > 2) || ((bundle_encoding[template][1] = L) && slot > 1)) {
@@ -271,6 +278,12 @@ static int valid_kprobe_addr(int templat
 		return -EINVAL;
 	}
 
+ 	if (in_ivt_code(addr)) {
+ 		printk(KERN_WARNING "Kprobes can't be inserted inside "
+				"IVT code at 0x%lx\n", addr);
+ 		return -EINVAL;
+ 	}
+
 	if (slot = 1) {
 		printk(KERN_WARNING "Inserting kprobes on slot #1 "
 		       "is not supported\n");

             reply	other threads:[~2005-06-24  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-24  0:28 Keshavamurthy Anil S [this message]
2005-06-24  1:38 ` [patch][ia64]Refuse kprobe on ivt code David Mosberger
2005-06-24 18:45   ` Keshavamurthy Anil S
2005-06-24 19:10     ` David Mosberger
2005-06-24 19:23       ` [patch][ia64]Refuse kprobe on ivt code- take 2 Keshavamurthy Anil S
2005-06-24 20:37         ` David Mosberger

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=20050623172832.B26121@unix-os.sc.intel.com \
    --to=anil.s.keshavamurthy@intel.com \
    --cc=akpm@osdl.org \
    --cc=linux-ia64@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox