This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
kprobes + nptl01 (test in ltp testsuite) problem
- From: "manjunath k" <kmanjunat at gmail dot com>
- To: systemtap at sourceware dot org
- Date: Tue, 24 Jul 2007 17:25:57 +0530
- Subject: kprobes + nptl01 (test in ltp testsuite) problem
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=BCiMlNAc7WWQvrYgplt/1KxZKx5TaodA8ks98H7WZcpXTLsrHWaQd9LMjcq8qcBSGyDpDQeur14ln5rzqvA05G77nrI0p24Z7FVF7EYzaEoUG6xcP6FKjaBGpxNbjfXbm053wY9uLV5kmWK+UvqDyxajKpVKLJgGac0qPqOq7es=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=ewcey+rAKu+eHURTfCELHapXs1+/dBtTOCaVkCqCVygxYqgKyrR9w8y7vxog8StJbuCqudoXUVqdEa2LxdT+agNs+fpB3QXKKg5gxTLOMFRnN05IahvCGdp1kITWP+m301BwF78WT7/LGvdKlt19nf3KTi0FDZS8JBXvoylZd5M=
Hi,
Ive been using the kprobes on X86 m/c and found the following problem with
the following kprobe and the testsuite.
1. A probe is placed for the sys_gettimeofday with the pre/post/fault handlers
defined (k-test.c is attached).
2. The nptl01 test from the ltp testuite is executed and the system gets into an
infinite loop (nptl01.c is attached).
Ive attached the log file that contains the output that was seen when
the above test is performed (kprobe-nptl.log), the log file is
stripped for the purpose of attaching.
Please provide me some information regarding the above failure.
-Manjunath
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
\viewkind4\uc1\pard\f0\fs20 #include <linux/module.h>\par
#include <linux/init.h>\par
#include <linux/kprobes.h>\par
#include <linux/kallsyms.h>\par
#include <linux/utsname.h>\par
#include <asm/uaccess.h>\par
\par
static struct kprobe k_004_kpr;\par
\par
void k_004_CPY_FROM_USER(struct file *file, char *buf, int len)\par
\{\par
\par
char x = 'a';\par
\par
if (put_user(x, buf)) \{\par
printk("put_user : -EFAULT\\n");\par
\}\par
\par
printk("CPY_FROM_USER\\n");\par
\}\par
\par
static void __exit k_004_exit_probe(void)\par
\{\par
printk("\\nModule exiting from sys_gettimeofday \\n");\par
unregister_kprobe(&k_004_kpr);\par
\}\par
\par
static int k_004_before_hook(struct kprobe *k_004_kpr, struct pt_regs *p)\par
\{\par
int len = 500;\par
struct file *file = NULL;\par
\par
printk("\\nBefore hook in sys_gettimeofday");\par
printk("\\nThis is the Kprobe pre \\n"\par
"handler for instruction at" "%p\\n", k_004_kpr->addr);\par
printk("Stack Dump:\\n");\par
dump_stack();\par
printk("The Registers are:\\n");\par
k_004_CPY_FROM_USER(file, NULL, len);\par
return 0;\par
\}\par
\par
static int k_004_after_hook(struct kprobe *k_004_kpr,\par
struct pt_regs *p, unsigned long flags)\par
\{\par
printk("\\nAfter hook in sys_gettimeofday");\par
printk("\\nThis is the Kprobe post \\n"\par
"handler for instruction at" " %p\\n", k_004_kpr->addr);\par
printk("Stack Dump:\\n");\par
dump_stack();\par
printk("The Registers are:\\n");\par
return 0;\par
\}\par
\par
int k_004_fault_probe(struct kprobe *p, struct pt_regs *regs, int trapnr)\par
\{\par
printk("\\nThis is the Kprobe fault \\n"\par
"handler for sys_gettimeodday\\n");\par
printk("fault_handler:p->addr=0x%p\\n", p->addr);\par
printk("Stack Dump:\\n");\par
dump_stack();\par
printk("The Registers are:\\n");\par
return 0;\par
\}\par
\par
static int __init k_004_init_probe(void)\par
\{\par
printk("\\nInserting the kprobes for sys_gettimeofday\\n");\par
\par
/* Registering a kprobe */\par
k_004_kpr.pre_handler = (kprobe_pre_handler_t) k_004_before_hook;\par
k_004_kpr.post_handler = (kprobe_post_handler_t) k_004_after_hook;\par
k_004_kpr.fault_handler = (kprobe_fault_handler_t) k_004_fault_probe;\par
#if 0\par
k_004_kpr.addr =\par
(kprobe_opcode_t *) kallsyms_lookup_name("sys_gettimeofday");\par
if (k_004_kpr.addr == NULL) \{\par
printk("kallsyms_lookup_name could not find address "\par
"for the specified symbol name\\n");\par
return 1;\par
\}\par
#endif\par
k_004_kpr.symbol_name = "sys_gettimeofday";\par
if( register_kprobe(&k_004_kpr) <0 ) \{\par
printk("k-004.c: register_kprobe is failed\\n");\par
return -1;\par
\}\par
\par
printk("register_kprobe is successful\\n");\par
printk("\\nAddress where the kprobe is \\n"\par
"going to be inserted - %p\\n", k_004_kpr.addr);\par
register_kprobe(&k_004_kpr);\par
return 0;\par
\}\par
\par
module_init(k_004_init_probe);\par
module_exit(k_004_exit_probe);\par
\par
MODULE_DESCRIPTION("Kprobes test module");\par
MODULE_LICENSE("GPL");\par
}
Attachment:
nptl01.c
Description: Text document
Attachment:
kprobes-nptl.log
Description: Binary data