mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivasa Ds <srinivasa@in.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: ananth@in.ibm.com, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] Transparently handle <.symbol> lookup for kprobes
Date: Mon, 23 Apr 2007 11:28:49 +0530	[thread overview]
Message-ID: <200704231128.49041.srinivasa@in.ibm.com> (raw)

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

When data symbols are not present in kernel image, user needs to add
dot(".") before function name explicitly, that he wants to probe in kprobe 
module on ppc64.

for ex:-
When data symbols are missing on ppc64,
====================
[root@llm27lp1 ~]# cat /proc/kallsyms | grep do_fork
c00000000006283c T .do_fork
==============================
User needs add "." to "do_fork"

kp.symbol_name = ".do_fork";
============================

This makes kprobe modules unportable. Below patch fixes the problem.


Signed-off-by: Srinivasa Ds <srinivasa@in.ibm.com>
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>



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

---
 include/asm-powerpc/kprobes.h |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-2.6.21-rc7/include/asm-powerpc/kprobes.h
===================================================================
--- linux-2.6.21-rc7.orig/include/asm-powerpc/kprobes.h
+++ linux-2.6.21-rc7/include/asm-powerpc/kprobes.h
@@ -64,6 +64,12 @@ typedef unsigned int kprobe_opcode_t;
 				addr = *(kprobe_opcode_t **)addr;	\
 		} else if (name[0] != '.')				\
 			addr = *(kprobe_opcode_t **)addr;		\
+	} else {							\
+		char dot_name[KSYM_NAME_LEN+1];				\
+		dot_name[0] = '.';					\
+		dot_name[1] = '\0';					\
+		strncat(dot_name, name, KSYM_NAME_LEN);			\
+		addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \
 	}								\
 }
 

             reply	other threads:[~2007-04-23  5:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-23  5:58 Srinivasa Ds [this message]
2007-04-24  5:59 ` Paul Mackerras
2007-04-24  6:44   ` Srinivasa Ds

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=200704231128.49041.srinivasa@in.ibm.com \
    --to=srinivasa@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --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

all inboxes | Powered by JetHome®