From: "Tej Parkash" <tejparkash.d@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: reg: kprobe method
Date: Thu, 31 May 2007 18:05:34 +0530 [thread overview]
Message-ID: <2bd9ebfa0705310535j412f11f4tfd2b44a5a4d04cfc@mail.gmail.com> (raw)
hi all
there is some problem in adding simple printk using kprobe method
i m posting the my code anybody can suggest how to make it work
#include<linux/kernel.h>
#include<linux/version.h>
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kprobes.h>
#include<linux/kallsyms.h>
MODULE_AUTHOR("TEJ");
MODULE_LICENSE("GPL");
//MODULE_PARM(int,val,I_IRUGO);
struct kprobe kp;
static int handler_pre(struct kprobe *p, struct pt_regs *regs)
{
printk("my name is tej parkash dhiman");
return 0;
}
void handler_post(struct kprobe *p, struct pt_regs *regs, unsigned long flags)
{
printk("mast hai na tej ash ker");
}
static int init_mod(void)
{
struct kprobe kp;
kp.post_handler=handler_post;
kp.pre_handler=handler_pre;
kp.addr = (kprobe_opcode_t *) 0xc0278e50; //add for __sock_create
if(kp.addr== NULL) {
printk("kallsyms_lookup_name could not find address
for the specified symbol name\n");
return 0;
}
register_kprobe(&kp);
printk("Module is inserted");
return 0;
}
void exit_mod(void)
{
unregister_kprobe(&kp);
printk("module is removed");
}
module_init(init_mod);
module_exit(exit_mod);
thanks
TEJ
reply other threads:[~2007-05-31 12:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=2bd9ebfa0705310535j412f11f4tfd2b44a5a4d04cfc@mail.gmail.com \
--to=tejparkash.d@gmail.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®