This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch : 3310 kprobe tests changes.



Patch to make kprobes tests to build and run irrespective of whether the kernel exports the function kallsyms_lookup_name or not.

These changes were needed as kernels later than 2.6.19 and RHEL5 kernels do not export kallsyms_lookup_name ().

Also fixes some testcases issues. - Sometimes kfree was getting called twice leading to system crash
- The number of lines to look for in /var/log/messages is determined on
the fly
- __switch_to under x86_64 is no more a function that can be probed.



The patch is also present as attachment in bugzilla id : 3310 Do review the patch and let me know your comments.


--
Thanks and Regards
-Srikar





diff -urpN kernel.org/colocated_probes/colocated_probes.c kernel.lat/colocated_probes/colocated_probes.c
--- kernel.org/colocated_probes/colocated_probes.c 2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/colocated_probes/colocated_probes.c 2007-03-23 14:36:13.000000000 +0530
@@ -20,20 +20,21 @@
* Contributors:
* Will Cohen <wcohen@redhat.com>
*
- * This is a simple program to verify that the kprobes allows + * This is a simple program to verify that the kprobes allows
* multiple probes can be placed at a single location.
*
* Running the test:
* FIXME
* To execute the test, install the module and "cat /proc/start_kprobe_test".
* The results of the test run will be printed to the kernel log.
- * + *
*/


#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/fs.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

MODULE_DESCRIPTION("Kprobe colocated testing Module");
MODULE_AUTHOR("Will Cohen <wcohen@redhat.com>");
@@ -42,7 +43,7 @@ MODULE_AUTHOR("Will Cohen <wcohen@redhat
#define LOOPS 10
#define PROBES_PER_ADDR 3

-static int kprobe_triggers=0;
+static int kprobe_triggers = 0;
static int kprobe_pre[PROBES_PER_ADDR];
static int kprobe_post[PROBES_PER_ADDR];

@@ -115,15 +116,15 @@ extern void kptest_do_nothing(void);

static void run_test(void)
{
-  int i, j;
+	int i, j;

-  for (j=0; j<RUNS; ++j){
-	  kprobe_triggers=0;
-	  /* estimate kprobe */
-	  for (i=0; i<LOOPS; ++i){
-		  kptest_do_nothing();
-	  }
-  }
+	for (j = 0; j < RUNS; ++j) {
+		kprobe_triggers = 0;
+		/* estimate kprobe */
+		for (i = 0; i < LOOPS; ++i) {
+			kptest_do_nothing();
+		}
+	}
}

static struct kprobe kp[] ={
@@ -144,34 +145,46 @@ static struct kprobe kp[] ={
	}
};

-int init_module(void)
+static int __init init_kpmod(void)
{
	int result;
	int i, j;
	int pass;

printk("Starting colocated probe test\n");
- for (i=0; i< (1<<PROBES_PER_ADDR); ++i){
+ for (i = 0; i < (1 << PROBES_PER_ADDR); ++i) {
pass = 1;
/* try the various permutations */
- for (j=0; j< PROBES_PER_ADDR; ++j) {
+ for (j = 0; j < PROBES_PER_ADDR; ++j) {
kprobe_pre[j] = 0;
kprobe_post[j] = 0;
}
/* install the probes */
- for (j=0; j< PROBES_PER_ADDR; ++j) {
- if (i & (1<<j)){
-#if defined (__powerpc64__)
- kp[j].addr = (kprobe_opcode_t *) + for (j = 0; j < PROBES_PER_ADDR; ++j) {
+ if (i & (1<<j)) {
+#ifndef USE_KALLSYMS_LOOKUP_NAME
+ kp[j].symbol_name = "kptest_do_nothing";
+ /* + * If the same structure gets re-used, + * addr element might have been updated.
+ * However for register_kprobe atleast + * one of symbol_name or addr need to be NULL
+ */
+ kp[j].addr=NULL;
+#else /* USE_KALLSYMS_LOOKUP_NAME */
+#ifdef CONFIG_PPC64
+ kp[j].addr = (kprobe_opcode_t *)
kallsyms_lookup_name(".kptest_do_nothing");
#else
kp[j].addr = (kprobe_opcode_t *)
kallsyms_lookup_name("kptest_do_nothing");
#endif
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+ printk (" COLOCATED PROBES : j = %d i = %d\n", j, i);
result = register_kprobe(&(kp[j]));
if (result) {
- printk("FAILED: for %d adding %d\n",
- i, j);
+ printk("FAILED: for %d adding %d failed with %d\n",
+ i, j, result);
pass = 0;
}
}
@@ -187,17 +200,17 @@ int init_module(void)
kprobe_pre[j]);
pass = 0;
}
- if ( ((i&(1<<j)) != 0) * RUNS * LOOPS != kprobe_post[j]) {
- printk("FAILED: mismatch kprobe_post[%d] ",
- j);
+ if (((i & (1<<j)) != 0) * RUNS * LOOPS !=
+ kprobe_post[j]) {
+ printk("FAILED: mismatch kprobe_post[%d] ", j);
printk("%d != %d\n", (i & (1<<j)) * RUNS*LOOPS,
kprobe_post[j]);
pass = 0;
}
}
/* remove the probes */
- for (j=0; j< PROBES_PER_ADDR; ++j) {
- if (i & (1<<j)){
+ for (j = 0; j < PROBES_PER_ADDR; ++j) {
+ if (i & (1<<j)) {
/* no check to determine whether
* unregister_kprobe successful */
unregister_kprobe(&(kp[j]));
@@ -213,18 +226,18 @@ int init_module(void)
run_test();
/* copy results and run test again to make sure that all
probes removed */
- for (j=0; j< PROBES_PER_ADDR; ++j) {
+ for (j = 0; j < PROBES_PER_ADDR; ++j) {
kprobe_pre[j]=0;
kprobe_post[j]=0;
}
/* check to make sure no changes in counts */
- for (j=0; j< PROBES_PER_ADDR; ++j) {
+ for (j = 0; j < PROBES_PER_ADDR; ++j) {
if (kprobe_pre[j])
printk("FAILED: kprobe_pre[%d] changed", j);
if (kprobe_post[j])
printk("FAILED: kprobe_post[%d] changed", j);
}
- if (pass) + if (pass)
printk("PASSED: for %d\n", i);
else
printk("FAILED: for %d\n", i);
@@ -233,9 +246,11 @@ int init_module(void)
return 0;
}


-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	/* nothing to clean up */
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/colocated_probes/test.sh kernel.lat/colocated_probes/test.sh
--- kernel.org/colocated_probes/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/colocated_probes/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -7,12 +7,15 @@ testresult=/tmp/${testname}.result
#
# Capture the last 15 lines in /var/log/messges
#
-loglines=15
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# Matching parttern in the log
expr1="Starting colocated probe"
expr2="PASSED\|FAILED"

+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
check_error()
{
	if test $1 != 0; then
@@ -28,7 +31,7 @@ if [ $? -eq "0" ]; then
fi
# Build the module
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."

@@ -36,7 +39,7 @@ check_error $? "Failed to build the test
/sbin/insmod ${testmodule}_dummy.ko
/sbin/insmod ${testmodule}.ko
check_error $? "Failed to load the module."
-sleep 1
+sleep 3
# Collect test result - last 15 lines in the log
$TESTRESULT ${testresult} ${loglines} "${expr1}" "${expr2}"
check_error $? "Failed to get test result"
diff -urpN kernel.org/functional_kprobe_test/harness_powerpc.c kernel.lat/functional_kprobe_test/harness_powerpc.c
--- kernel.org/functional_kprobe_test/harness_powerpc.c 1970-01-01 05:30:00.000000000 +0530
+++ kernel.lat/functional_kprobe_test/harness_powerpc.c 2007-03-23 14:36:13.000000000 +0530
@@ -0,0 +1,147 @@
+/*
+ * Kprobes Functional Test Module
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Intel Corporation, 2005
+ *
+ * Contributors:
+ * Rusty Lynch <rusty.lynch@intel.com>
+ *
+ * This module will attempt to cover a large number of kprobe cases by
+ * looping through a test function, each time inserting a kprobe at a + * different instruction, and then:
+ * - Validating the test function still returns the expected value
+ * - Validating the probe was triggered or not triggered, depending
+ * on the test function
+ *
+ * This level of functional testing is architecture specific, meaning
+ * that the test function should be crafted to expose all the corner cases
+ * that are hard to express without using assembly. To facilitate multiple
+ * achitectures, the make file will look for the following files:
+ * - $(ARCH)_driver.c
+ * - $(ARCH)_probe_points.S
+ *
+ * The harness, harness.c, will call into the arch specific code using:
+ * - void update_measured_trace(struct pt_regs *regs)
+ * - void generate_expected_trace(void)
+ * - int get_max_trace_level(void)
+ * - int tc1_fn(void)
+ *
+ * Running the test:
+ * To execute the test, install the module and "cat /proc/start_kprobe_test".
+ * The results of the test run will be printed to the kernel log.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/kallsyms.h>
+#include <linux/proc_fs.h>
+#include <linux/kprobes.h>
+
+extern void update_measured_trace(struct pt_regs *regs);
+extern void generate_expected_trace(void);
+extern int get_max_trace_level(void);
+
+extern int tc1_fn(void);
+
+extern unsigned long measured_trace[];
+extern unsigned long expected_trace[];
+
+MODULE_DESCRIPTION("Kprobe Testing Module");
+MODULE_AUTHOR("Rusty Lynch <rusty.lynch@intel.com>");
+
+static int test_pre_handler(struct kprobe *p, struct pt_regs *regs)
+{
+ update_measured_trace(regs);
+ return 0;
+}
+
+static struct kprobe test_kp = {
+ .addr = 0,
+ .pre_handler = test_pre_handler,
+};
+
+static int show_start_kprobe_test(char *page, char **start, off_t offset,
+ int count, int *eof, void *data)
+{
+ int i, ret = 0;
+
+ /* generate trace */
+ for (i=0; i<get_max_trace_level(); i++) {
+ test_kp.pre_handler = test_pre_handler;
+ test_kp.addr = (kprobe_opcode_t *)expected_trace[i];
+
+ if (!test_kp.addr) {
+ printk(KERN_DEBUG "Invalid testcase... aborting\n");
+ goto test_failed;
+ }
+
+ printk(KERN_DEBUG "[%p]Starting trace %i\n", test_kp.addr, i);
+ if (register_kprobe(&test_kp))
+ goto test_failed;
+ ret = tc1_fn();
+ unregister_kprobe(&test_kp);
+
+#ifdef CONFIG_PPC64
+ if (ret != 0x5678) {
+#else
+ if (ret != 0xdeadbeef) {
+#endif
+ printk(KERN_DEBUG "[kprobe_test] Unexpected test "
+ "function return\n");
+ goto test_failed;
+ }
+
+ if (measured_trace[i] != expected_trace[i]) {
+ printk(KERN_DEBUG "[kprobe_test] Unexpected trace\n");
+ goto test_failed;
+ } else
+ printk("[kprobe_test] %d Success!\n", i);
+ }
+
+ printk(KERN_INFO "[kprobe_test] Test passed!\n");
+ return 0;
+
+ test_failed:
+ printk(KERN_INFO "[kprobe_test] Test failed!\n");
+ return -EINVAL;
+}
+
+static int __init harness_init(void)
+{
+ struct proc_dir_entry *e;
+
+ printk(KERN_INFO "[kprobe_test] Initializing kprobe test harness\n");
+ e = create_proc_entry("start_kprobe_test", S_IFREG|S_IRUGO, 0);
+ if (!e)
+ return -EIO;
+
+ e->read_proc = show_start_kprobe_test;
+
+ generate_expected_trace();
+ return 0;
+}
+
+static void __exit harness_exit(void)
+{
+ printk(KERN_INFO "[kprobe_test] Removing kprobe test harness\n");
+ remove_proc_entry("start_kprobe_test", 0);
+}
+
+module_exit(harness_exit);
+module_init(harness_init);
+MODULE_LICENSE("GPL");
diff -urpN kernel.org/functional_kprobe_test/Makefile kernel.lat/functional_kprobe_test/Makefile
--- kernel.org/functional_kprobe_test/Makefile 2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/functional_kprobe_test/Makefile 2007-03-23 14:36:13.000000000 +0530
@@ -1,12 +1,14 @@
buildtest:
make -C /lib/modules/`uname -r`/build M=`pwd` modules


-obj-m += kprobe_test.o
+obj-m += kprobe_test.o


+ifeq ($(ARCH), powerpc)
+kprobe_test-objs := harness_powerpc.o $(ARCH)_driver.o $(ARCH)_probe_points.S
+else ifeq ($(ARCH), ppc64)
-kprobe_test-objs := harness_ppc64.o $(ARCH)_driver.o $(ARCH)_probe_points.o
-else
-kprobe_test-objs := harness.o $(ARCH)_probe_points.o
+ kprobe_test-objs := harness.o $(ARCH)_probe_points.o
+endif
endif


clean:
diff -urpN kernel.org/functional_kprobe_test/powerpc_driver.c kernel.lat/functional_kprobe_test/powerpc_driver.c
--- kernel.org/functional_kprobe_test/powerpc_driver.c	1970-01-01 05:30:00.000000000 +0530
+++ kernel.lat/functional_kprobe_test/powerpc_driver.c	2007-03-23 14:36:13.000000000 +0530
@@ -0,0 +1,94 @@
+/*
+ * ppc64 specific test driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Intel Corporation, 2005
+ *
+ * Contributors:
+ * Derived from Rusty Lynch's ia64 prototype.
+ * Ananth N Mavinakayanahalli <ananth@in.ibm.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/kallsyms.h>
+#include <linux/kprobes.h>
+
+/* This must be syncronized with probe point changes */
+#define MAX_TRACE_LEVEL 10
+
+unsigned long measured_trace[MAX_TRACE_LEVEL];
+unsigned long expected_trace[MAX_TRACE_LEVEL];
+
+int current_trace = 0;
+
+int get_max_trace_level(void)
+{
+	return MAX_TRACE_LEVEL;
+}
+
+/*
+ * We hand code the contents of expected_trace[], so any change
+ * in the probed functions will require this to be altered.
+ *
+ * Since we are a module, we can just hard code the instruction addresses
+ * in a static structure.
+ */
+
+void generate_expected_trace(void)
+{
+	int i;
+
+	/* start tc1_fn */
+	expected_trace[0] = kallsyms_lookup_name(".tc1_fn"); /* li */
+	expected_trace[1] = kallsyms_lookup_name(".tc1_fn") + 0x04; /* b .tc2 */
+
+	/* call to tc2_fn */
+	expected_trace[2] = kallsyms_lookup_name(".tc2_fn"); /* cmpwi */
+	expected_trace[3] = kallsyms_lookup_name(".tc2_fn") + 0x04; /* beq 9f */
+
+	/*
+	 * not executed
+	 * li r3, 0x00
+	 * blr
+	 */
+
+	/* jump to match */
+ 	expected_trace[4] = kallsyms_lookup_name(".tc2_fn") + 0x10; /* li */
+ 	expected_trace[5] = kallsyms_lookup_name(".tc2_fn") + 0x14; /* blr */
+
+	expected_trace[6] = kallsyms_lookup_name(".tc1_fn") + 0x08; /* cmpwi */
+	expected_trace[7] = kallsyms_lookup_name(".tc1_fn") + 0x14; /* b tc3 */
+
+	/* start tc3_fn */
+	expected_trace[8] = kallsyms_lookup_name(".tc3_fn"); /* blr */
+
+	/* return to tc1_fn */
+	expected_trace[9] = kallsyms_lookup_name(".tc1_fn") + 0x18; /* blr */
+
+
+	/* initialize the measured data */
+	for (i=0; i<MAX_TRACE_LEVEL; i++)
+		measured_trace[i] = 0;
+}
+
+void update_measured_trace(struct pt_regs *regs)
+{
+	if (current_trace > MAX_TRACE_LEVEL)
+		return;
+
+	measured_trace[current_trace++] = instruction_pointer(regs);
+}
diff -urpN kernel.org/functional_kprobe_test/powerpc_probe_points.S kernel.lat/functional_kprobe_test/powerpc_probe_points.S
--- kernel.org/functional_kprobe_test/powerpc_probe_points.S	1970-01-01 05:30:00.000000000 +0530
+++ kernel.lat/functional_kprobe_test/powerpc_probe_points.S	2007-03-23 14:36:13.000000000 +0530
@@ -0,0 +1,67 @@
+/*
+ *  ppc64 specific probe points
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) Intel Corporation, 2005
+ *
+ * Contributors:
+ * Rusty Lynch <rusty.lynch@intel.com>
+ * Will Cohen <wcohen@redhat.com>
+ * Adapted for ppc64 by Ananth N Mavinakayanahalli <ananth@in.ibm.com>
+#include <linux/config.h>
+#include <asm/ppc_asm.h>
+ */
+
+#include <linux/linkage.h>
+#include <asm/processor.h>
+
+.text
+	/*
+	 * The idea here is include as many instruction scenarios as possible
+	 * in such a way where it is possible to tell if an emulated funtion
+	 * changed the execution.  Some examples are
+	 *    - a kprobe inserted on a function call (b.call) results in
+	 *      the processor jumping to the wrong address
+	 *    - a kprobe inserted on a "li rX,value" resulted in the wrong
+	 *      value to be stored in rX
+	 *    - a kprobe inserted on a return (blr - branch to Link Register)
+	 *	resulted in the code returning to an incorrect location
+	 *
+	 * WARNING!!! Any changes to this file will require adjusting:
+	 *	tables in ppc64_driver.c
+	 *
+	 * NOTE: Due to tail call optimizations, the returns from tc(2/3)_fn
+	 *	are coded as unconditional branches.
+	 */
+_GLOBAL(tc1_fn)
+	li	r3,0x1234	/* fill in known value */
+	b	.tc2_fn		/* call a function */
+1:	cmpwi	0,r3,0
+	bne	2f
+	li	r3,0x6fff	/* put in a known error value */
+2:	b	.tc3_fn		/* dummy fn */
+3:	blr			/* return with tc2_fn's return value */
+
+_GLOBAL(tc2_fn)
+	cmpwi	0,r3,0x1234	/* compare input with known value */
+	beq	4f
+	li	r3,0x0		/* we should not execute this instruction */
+	b	1b
+4:	li	r3,0x5678	/* set return value to a known value */
+	b	1b
+
+_GLOBAL(tc3_fn)
+	b	3b
diff -urpN kernel.org/functional_kprobe_test/ppc64_probe_points.S kernel.lat/functional_kprobe_test/ppc64_probe_points.S
--- kernel.org/functional_kprobe_test/ppc64_probe_points.S	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/functional_kprobe_test/ppc64_probe_points.S	2007-03-23 14:36:13.000000000 +0530
@@ -21,9 +21,9 @@
 * Rusty Lynch <rusty.lynch@intel.com>
 * Will Cohen <wcohen@redhat.com>
 * Adapted for ppc64 by Ananth N Mavinakayanahalli <ananth@in.ibm.com>
+#include <linux/config.h>
 */

-#include <linux/config.h>
#include <linux/linkage.h>
#include <asm/processor.h>
#include <asm/ppc_asm.h>
diff -urpN kernel.org/functional_kprobe_test/test.sh kernel.lat/functional_kprobe_test/test.sh
--- kernel.org/functional_kprobe_test/test.sh 2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/functional_kprobe_test/test.sh 2007-03-23 14:36:13.000000000 +0530
@@ -5,16 +5,15 @@ testmodule=kprobe_test
TESTRESULT=../getresult.sh
testresult=/tmp/${testname}.result
ARCH=`uname -m`
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# Capture the last 55 lines of /var/log/messages
#
# Matching parttern in the log
if [ $ARCH = "ppc64" ]; then
-loglines=15
expr1="Initializing kprobe test harness"
expr2="kprobe_test"
else
-loglines=55
expr1="show_start_kprobe_test"
expr2="All 15 tests passed!"
fi
diff -urpN kernel.org/getresult.sh kernel.lat/getresult.sh
--- kernel.org/getresult.sh 2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/getresult.sh 2007-03-23 14:36:13.000000000 +0530
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash #
varlogmsg=${1}.msg
test_result=${1}
@@ -9,7 +9,7 @@ expr2=${4}


LOG=/var/log/messages

-/usr/bin/tail -${num_varlogmsg} ${LOG} > ${varlogmsg}
+/usr/bin/tail -n +${num_varlogmsg} ${LOG} > ${varlogmsg}
while read
do
	line=$REPLY
@@ -18,7 +18,7 @@ do
# First look for the start of test
#
	if [ $_starttest -eq "0" ]; then
-		echo $line | grep "$expr1" > /dev/null
+		echo $line | grep "$expr1" >/dev/null
		if [ $? -eq "0" ]; then
			echo $line | sed 's/.*\(kernel\|klogd\): //g' > $test_result
			_starttest="2"
diff -urpN kernel.org/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006.c kernel.lat/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006.c
--- kernel.org/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006.c	2007-03-23 14:36:13.000000000 +0530
@@ -5,6 +5,7 @@
#include <linux/kprobes.h>
#include <linux/sched.h>
#include <linux/mm.h>
+#include <linux/version.h>

extern void my_test_reentrant_export_function(void);
static unsigned long long rpct;
@@ -24,11 +25,13 @@ static int show_start_kprobe_test(char *
	my_test_function_bz2006();
	return 0;
}
+
#if defined (__ppc64__) || defined (__powerpc__)
static char func[]=".my_test_function_bz2006";
#else
static char func[]="my_test_function_bz2006";
#endif
+
int rp_pre(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	rpct++;
@@ -36,7 +39,7 @@ int rp_pre(struct kretprobe_instance *ri
	return 0;
}

-int init_module(void)
+static int __init init_kpmod(void)
{
	struct proc_dir_entry *e;
	e = create_proc_entry("start_bz2006", S_IFREG|S_IRUGO, 0);
@@ -46,13 +49,18 @@ int init_module(void)

	rp.handler = rp_pre;
	rp.maxactive = 1024;
-	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(func);

+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	rp.kp.symbol_name = func;
+#else
+	rp.kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name(func);
	if (!rp.kp.addr) {
		printk("Couldn't find addresses to plant probe\n");
		return -1;
	}
-	if ( register_kretprobe(&rp) < 0) {
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
+	if (register_kretprobe(&rp) < 0) {
		printk("register_probe failed\n");
		return -1;
	}
@@ -60,11 +68,12 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	unregister_kretprobe(&rp);
	remove_proc_entry("start_bz2006", 0);
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
-
diff -urpN kernel.org/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006_reent.c kernel.lat/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006_reent.c
--- kernel.org/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006_reent.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/incorrect_nmissed_cnt_bz2006/incorrect_nmissed_cnt_bz2006_reent.c	2007-03-23 14:36:13.000000000 +0530
@@ -4,6 +4,7 @@
#include <linux/kallsyms.h>
#include <linux/sched.h>
#include <linux/mm.h>
+#include <linux/version.h>

static unsigned long long rpct;
static struct kretprobe rp;
@@ -20,19 +21,27 @@ int rp_pre(struct kretprobe_instance *ri
	return 0;
}

-int init_module(void)
+int init_kpmod(void)
{
	rp.handler = rp_pre;
	rp.maxactive = 1024;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	rp.kp.symbol_name = "my_test_reentrant_export_function";
+#else
#if defined (__ppc64__) || defined (__powerpc__)
-	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".my_test_reentrant_export_function");
+	rp.kp.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name(".my_test_reentrant_export_function");
#else
-	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name("my_test_reentrant_export_function");
+	rp.kp.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name("my_test_reentrant_export_function");
#endif
	if (!rp.kp.addr) {
		printk("Couldn't find addresses to plant probe\n");
		return -1;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
	if (register_kretprobe(&rp) < 0) {
		printk("register_probe failed\n");
		return -1;
@@ -40,7 +49,7 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+void cleanup_kpmod(void)
{
	unregister_kretprobe(&rp);
	if ((rpct == 0) && (rp.kp.nmissed > 0))
@@ -49,4 +58,6 @@ void cleanup_module(void)
		printk("FAILED: nmissed count is %ld\n", rp.kp.nmissed);
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/incorrect_nmissed_cnt_bz2006/test.sh kernel.lat/incorrect_nmissed_cnt_bz2006/test.sh
--- kernel.org/incorrect_nmissed_cnt_bz2006/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/incorrect_nmissed_cnt_bz2006/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -12,7 +12,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=3
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -20,6 +20,10 @@ loglines=3
expr1="my_test_function_bz2006"
expr2="nmissed"

+
+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait
# after loading the test module.
@@ -49,7 +53,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/jprobes_save_restore_args_bz1953/jprobes_save_restore_args_bz1953.c kernel.lat/jprobes_save_restore_args_bz1953/jprobes_save_restore_args_bz1953.c
--- kernel.org/jprobes_save_restore_args_bz1953/jprobes_save_restore_args_bz1953.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/jprobes_save_restore_args_bz1953/jprobes_save_restore_args_bz1953.c	2007-03-23 14:36:13.000000000 +0530
@@ -5,10 +5,10 @@
#include <linux/uio.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

static int g_flag =0;

-
/*
 * Jumper probe for do_fork.
 * Mirror principle enables access to arguments of the probed routine
@@ -20,7 +20,6 @@ long jdo_fork(unsigned long clone_flags,
	      struct pt_regs *regs, unsigned long stack_size,
	      int __user * parent_tidptr, int __user * child_tidptr)
{
-
	/* Modify all the function argument */
	clone_flags = 0;
	stack_start = 0;
@@ -28,7 +27,7 @@ long jdo_fork(unsigned long clone_flags,
	stack_size = 0xffffffff;
	parent_tidptr = NULL;
	child_tidptr = NULL;
-	
+
	if (g_flag == 0) {
		printk("Jprobes function arguments modified\n");
		g_flag++;
@@ -41,23 +40,31 @@ long jdo_fork(unsigned long clone_flags,
}

static struct jprobe my_jprobe = {
-	.entry = (kprobe_opcode_t *) jdo_fork
+	.entry = (kprobe_opcode_t *)jdo_fork
};

-int init_module(void)
+static int __init init_kpmod(void)
{
	int ret;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	my_jprobe.kp.symbol_name = "do_fork";
+#else /* USE_KALLSYMS_LOOKUP_NAME */
#ifdef __powerpc64__
-	my_jprobe.kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name(".do_fork");
+	my_jprobe.kp.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name(".do_fork");
#else
-	my_jprobe.kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name("do_fork");
+	my_jprobe.kp.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name("do_fork");
#endif
	if (!my_jprobe.kp.addr) {
		printk("Couldn't find %s to plant jprobe\n", "do_fork");
		return -1;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

-	if ((ret = register_jprobe(&my_jprobe)) <0) {
+	ret = register_jprobe(&my_jprobe);
+	if (ret < 0) {
		printk("register_jprobe failed, returned %d\n", ret);
		return -1;
	}
@@ -66,10 +73,12 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	unregister_jprobe(&my_jprobe);
	printk("jprobes_save_restore_args_bz195 unregistered\n");
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/jprobes_save_restore_args_bz1953/test.sh kernel.lat/jprobes_save_restore_args_bz1953/test.sh
--- kernel.org/jprobes_save_restore_args_bz1953/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/jprobes_save_restore_args_bz1953/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,7 +11,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=20
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -19,6 +19,9 @@ loglines=20
expr1="Jprobes function arguments modified"
expr2="nothing"

+# Set special compile flag if function kallsyms_lookup_name is exported +MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait # after loading the test module.
@@ -48,7 +51,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1


check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/kallsyms.sh kernel.lat/kallsyms.sh
--- kernel.org/kallsyms.sh 1970-01-01 05:30:00.000000000 +0530
+++ kernel.lat/kallsyms.sh 2007-03-23 15:04:06.000000000 +0530
@@ -0,0 +1,33 @@
+#! /bin/bash
+x=`uname -r`;
+
+#convert any - to . +x=${x//-/.};
+
+if [[ "$x" < "2.6.18.1" ]] +then +
+ # Kernel is earlier than 2.6.18-1
+ # Compiling for Linux kernel version + # where kallsyms_lookup_name() is exported +
+ echo "EXTRA_CFLAGS=\"-DUSE_KALLSYMS_LOOKUP_NAME\" ";
+
+else + if [[ "$x" < "2.6.19" ]]
+ then +
+ # Kernel is later than 2.6.18-1 but earlier than 2.6.19
+
+ if ! `echo $x | grep -q "\.el5"`
+ then +
+ # Compiling for Linux kernel version where + # kallsyms_lookup_name() is exported +
+ echo "EXTRA_CFLAGS=\"-DUSE_KALLSYMS_LOOKUP_NAME\" ";
+ fi
+ fi
+fi
+
+
diff -urpN kernel.org/kprobe_irq_sched_bz1229/mon_irq.c kernel.lat/kprobe_irq_sched_bz1229/mon_irq.c
--- kernel.org/kprobe_irq_sched_bz1229/mon_irq.c 2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_irq_sched_bz1229/mon_irq.c 2007-03-23 14:36:13.000000000 +0530
@@ -3,10 +3,11 @@
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
#include <linux/sched.h>
+#include <linux/version.h>


#include <linux/mm.h>

-static unsigned long long kpct,jpct,rpct;
+static unsigned long long kpct, jpct, rpct;
static struct kprobe kp;
static struct jprobe jp;
static struct kretprobe rp;
@@ -29,21 +30,27 @@ int rp_pre(struct kretprobe_instance *ri
	return 0;
}

-int init_module(void)
+static int __init init_kpmod(void)
{
	kp.pre_handler = kp_pre;
	jp.entry = (kprobe_opcode_t *)jp_pre;
	rp.handler = rp_pre;
	rp.maxactive = 1024;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	kp.symbol_name = jp.kp.symbol_name = rp.kp.symbol_name = "do_IRQ";
+#else
	kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".do_IRQ");
	jp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".do_IRQ");
	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".do_IRQ");
-
	if (!kp.addr || !jp.kp.addr || !rp.kp.addr) {
		printk("Couldn't find addresses to plant probe\n");
		return -1;
	}
-	if (register_kprobe(&kp) < 0 || register_jprobe(&jp) < 0 || register_kretprobe(&rp) < 0) {
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
+	if (register_kprobe(&kp) < 0 ||
+		register_jprobe(&jp) < 0 || register_kretprobe(&rp) < 0) {
		printk("register_probe failed\n");
		return -1;
	}
@@ -51,7 +58,7 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	unregister_kprobe(&kp);
	unregister_jprobe(&jp);
@@ -62,4 +69,6 @@ void cleanup_module(void)
	printk("rp: %llu\n",rpct);
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/kprobe_irq_sched_bz1229/mon_sched.c kernel.lat/kprobe_irq_sched_bz1229/mon_sched.c
--- kernel.org/kprobe_irq_sched_bz1229/mon_sched.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_irq_sched_bz1229/mon_sched.c	2007-03-23 14:36:13.000000000 +0530
@@ -3,10 +3,11 @@
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
#include <linux/sched.h>
+#include <linux/version.h>

#include <linux/mm.h>

-static unsigned long long kpct,jpct,rpct;
+static unsigned long long kpct, jpct, rpct;
static struct kprobe kp;
static struct jprobe jp;
static struct kretprobe rp;
@@ -29,21 +30,27 @@ int rp_pre(struct kretprobe_instance *ri
	return 0;
}

-int init_module(void)
+static int __init init_kpmod(void)
{
	kp.pre_handler = kp_pre;
	jp.entry = (kprobe_opcode_t *)jp_pre;
	rp.handler = rp_pre;
	rp.maxactive = 1024;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	kp.symbol_name = jp.kp.symbol_name = rp.kp.symbol_name = "schedule";
+#else
	kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".schedule");
	jp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".schedule");
	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".schedule");
-
	if (!kp.addr || !jp.kp.addr || !rp.kp.addr) {
		printk("Couldn't find addresses to plant probe\n");
		return -1;
	}
-	if (register_kprobe(&kp) < 0 || register_jprobe(&jp) < 0 || register_kretprobe(&rp) < 0) {
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
+	if (register_kprobe(&kp) < 0 ||
+		register_jprobe(&jp) < 0 || register_kretprobe(&rp) < 0) {
		printk("register_probe failed\n");
		return -1;
	}
@@ -51,7 +58,7 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	unregister_kprobe(&kp);
	unregister_jprobe(&jp);
@@ -62,4 +69,6 @@ void cleanup_module(void)
	printk("rp: %llu\n",rpct);
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/kprobe_irq_sched_bz1229/README kernel.lat/kprobe_irq_sched_bz1229/README
--- kernel.org/kprobe_irq_sched_bz1229/README	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_irq_sched_bz1229/README	2007-03-23 14:36:13.000000000 +0530
@@ -1,3 +1,5 @@
+NOTE: THIS ISSUE IS REDUNDANT WITH RCU BEING USED FOR LOCKING
+
Problem statement:

I have two bare-bones C modules: The first places a kprobe, jprobe, & kretprobe
diff -urpN kernel.org/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.c kernel.lat/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.c
--- kernel.org/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.c	2007-03-23 14:36:13.000000000 +0530
@@ -2,9 +2,10 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>
#include <asm/kprobes.h>

-static struct kprobe kp;
+static struct kprobe kp, kp1;
static count[NR_CPUS];

int trap_pre_handler(struct kprobe *p, struct pt_regs *regs)
@@ -13,45 +14,50 @@ int trap_pre_handler(struct kprobe *p, s
	return 0;
}

-static int init_trap_test(void)
+static int __init init_trap_test(void)
{
	int ret;

printk("Starting kprobe_on_trap test\n");

+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	kp.symbol_name = "elv_dequeue_request";
+#else
	kp.addr = (kprobe_opcode_t *)
			kallsyms_lookup_name(".elv_dequeue_request");
-
	if (!kp.addr) {
		printk("FAIL: Could not resolve elv_dequeue_request\n");
		return -EINVAL;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

-	while (!is_trap(*(kp.addr)))
-		kp.addr += 4;
+	ret = register_kprobe(&kp);
+	if (ret)
+		return ret;

-	printk("PASS: Found trap insn: %x\n", *(kp.addr));
+	kp1.addr = kp.addr;
+	while (!is_trap(*(kp1.addr)))
+		kp1.addr += 4;

-	kp.pre_handler = trap_pre_handler;
+	kp1.pre_handler = trap_pre_handler;

-	ret = register_kprobe(&kp);
+	ret = register_kprobe(&kp1);
	if (ret) {
-		printk("FAIL: Kprobe registration failed\n");
+		printk("FAILED: Kprobe registration failed\n");
		return ret;
	}
	printk("PASS: Registered kprobe on tdnei\n");
+	unregister_kprobe(&kp);

	return 0;
}

-static void cleanup_trap_test(void)
+static void __exit cleanup_trap_test(void)
{
-	int i;
-
-	unregister_kprobe(&kp);
+	unregister_kprobe(&kp1);
	printk("PASS: Kprobe on tdnei unregistered\n");
}

-module_init(init_trap_test);
-module_exit(cleanup_trap_test);
+module_init(init_trap_test)
+module_exit(cleanup_trap_test)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.out kernel.lat/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.out
--- kernel.org/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.out	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_on_trap_bz2453/kprobe_on_trap_bz2453.out	2007-03-23 14:36:13.000000000 +0530
@@ -1,4 +1,3 @@
Starting kprobe_on_trap test
-PASS: Found trap insn: b000000
PASS: Registered kprobe on tdnei
PASS: Kprobe on tdnei unregistered
diff -urpN kernel.org/kprobe_on_trap_bz2453/test.sh kernel.lat/kprobe_on_trap_bz2453/test.sh
--- kernel.org/kprobe_on_trap_bz2453/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_on_trap_bz2453/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,7 +11,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=20
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -20,6 +20,9 @@ expr1="Starting kprobe_on_trap test"
expr2="PASS\|FAIL"
SUPPORTED_ARCHS="ppc64"

+#set special compile flags if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
check_supported_arch()
{
	# This test should only run on x86_64 and i686 machines.
@@ -54,7 +57,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."

diff -urpN kernel.org/kprobe_unregister_bz1234/test1.c kernel.lat/kprobe_unregister_bz1234/test1.c
--- kernel.org/kprobe_unregister_bz1234/test1.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_unregister_bz1234/test1.c	2007-03-23 14:36:13.000000000 +0530
@@ -1,13 +1,14 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

static int num = 0;

static int inst_sys_getuid (struct kprobe *p, struct pt_regs *regs)
{
-  num++;
-  return 0;
+	num++;
+	return 0;
}

/*For each probe you need to allocate a kprobe structure*/
@@ -17,22 +18,33 @@ static struct kprobe kp = {
	.fault_handler = NULL,
};

-int init_module(void)
+static int __init init_kpmod(void)
{
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	kp.symbol_name = "sys_getuid";
+#else
#if defined (__powerpc64__)
-	kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name(".sys_getuid");
+	kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name(".sys_getuid");
#else
-	kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("sys_getuid");
+	kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name("sys_getuid");
#endif
-	register_kprobe(&kp);
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
+	if (register_kprobe(&kp) < 0) {
+		printk("Could not register kprobe on sys_getuid\n");
+		return 1;
+	}
+
	printk("kprobe registered\n");
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
-  unregister_kprobe(&kp);
-  printk("sys_getuid() called %d times.\n",num);
+	unregister_kprobe(&kp);
+	printk("sys_getuid() called %d times.\n",num);
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/kprobe_unregister_bz1234/test.sh kernel.lat/kprobe_unregister_bz1234/test.sh
--- kernel.org/kprobe_unregister_bz1234/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kprobe_unregister_bz1234/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -4,6 +4,10 @@ testname=kprobe_unregister
testresult=/tmp/${testname}.result
#

+
+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
check_error()
{
	if test $1 != 0; then
@@ -12,7 +16,8 @@ check_error()
	fi
}
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1
+
check_error $? "Failed to build the test module."

./please_crash_me > $testresult diff -urpN kernel.org/kretprobe_crash_bz2658/kretprobe_crash_bz2658.c kernel.lat/kretprobe_crash_bz2658/kretprobe_crash_bz2658.c
--- kernel.org/kretprobe_crash_bz2658/kretprobe_crash_bz2658.c 2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_crash_bz2658/kretprobe_crash_bz2658.c 2007-03-23 14:36:13.000000000 +0530
@@ -1,11 +1,13 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>


static struct kretprobe *rp;

int test_rp_fn(void)
{
+	printk("In test_rp_fn\n");
	if (jiffies % 2)
		return 0;
	else
@@ -14,6 +16,7 @@ int test_rp_fn(void)

int rp_handler(struct kretprobe_instance *ri, struct pt_regs *regs)
{
+	printk("rp_handler, post_handler = %p\n", ri->rp->kp.post_handler);
	if (!ri->rp->kp.post_handler)
		printk("PASS: post_handler is NULL\n");
	else
@@ -22,28 +25,31 @@ int rp_handler(struct kretprobe_instance
	return 0;
}

-static int init_testrp(void)
+
+static struct kretprobe my_kretprobe;
+
+
+static int __init init_testrp(void)
{
	int ret;

	printk("Starting kretprobe_crash_bz2658 test\n");
-
-	rp = kmalloc(sizeof(struct kretprobe), GFP_KERNEL);
-	if (!rp) {
-		printk("FAIL: Error allocating a retprobe\n");
-		return 1;
-	}
+	rp=&my_kretprobe;
	rp->kp.addr = (kprobe_opcode_t *)NULL;

+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	rp->kp.symbol_name = "test_rp_fn";
+#else
#ifdef CONFIG_PPC64
	rp->kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name(".test_rp_fn");
#else
	rp->kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name("test_rp_fn");
#endif
	if (!rp->kp.addr) {
-		printk("FAIL: Cannot resolve do_fork()\n");
+		printk("FAIL: Cannot resolve test_rp_fn()\n");
		goto ret_err;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

	rp->handler = rp_handler;
	rp->maxactive = 10;
@@ -51,27 +57,28 @@ static int init_testrp(void)

	ret = register_kretprobe(rp);
	if (ret) {
-		printk("FAIL: Cound not register retprobe on do_fork\n");
+		printk("FAIL: Cound not register retprobe on test_rp_fn addr \n" );
		goto ret_err;
	}

	printk("PASS: kretprobe registered...\n");
	ret = test_rp_fn();
+	if (ret)
+		ret--;
+	else
+		ret++;
	return 0;

ret_err:
-	kfree(rp);
	return 1;
}

-static void cleanup_testrp(void)
+static void __exit cleanup_testrp(void)
{
	unregister_kretprobe(rp);
-	kfree(rp);
	printk("PASS: kretprobe unregistered.\n");
}

module_init(init_testrp);
module_exit(cleanup_testrp);
MODULE_LICENSE("GPL");
-
diff -urpN kernel.org/kretprobe_crash_bz2658/test.sh kernel.lat/kretprobe_crash_bz2658/test.sh
--- kernel.org/kretprobe_crash_bz2658/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_crash_bz2658/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,7 +11,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=10
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -19,6 +19,9 @@ loglines=10
expr1="bz2658 test"
expr2="PASS\|FAIL"

+#set special compile flag if function kallsyms_lookup_name is exported
+MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait
# after loading the test module.
@@ -48,7 +51,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/kretprobe_deadlock_bz2162/kretprobe_deadlock_bz2162.c kernel.lat/kretprobe_deadlock_bz2162/kretprobe_deadlock_bz2162.c
--- kernel.org/kretprobe_deadlock_bz2162/kretprobe_deadlock_bz2162.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_deadlock_bz2162/kretprobe_deadlock_bz2162.c	2007-03-23 14:36:13.000000000 +0530
@@ -1,6 +1,7 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

MODULE_DESCRIPTION("kretprobe deadlock testing module");
MODULE_AUTHOR("Ananth N Mavinakayanahalli <ananth@in.ibm.com>");
@@ -30,12 +31,16 @@ static struct kretprobe kfree_rp = {
	.maxactive = 10
};

-static int init_rp_race(void)
+static int __init init_rp_race(void)
{
	int ret;

printk("Starting kretprobe_deadlock_bz2162 test\n");

+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	link_rp.kp.symbol_name = "sys_link";
+	kfree_rp.kp.symbol_name = "kfree";
+#else
#ifdef CONFIG_PPC64
	link_rp.kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name(".sys_link");
	kfree_rp.kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name(".kfree");
@@ -43,6 +48,7 @@ static int init_rp_race(void)
	link_rp.kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name("sys_link");
	kfree_rp.kp.addr = (kprobe_opcode_t *)kallsyms_lookup_name("kfree");
#endif
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

	ret = register_kretprobe(&link_rp);
	if (ret) {
@@ -59,7 +65,7 @@ static int init_rp_race(void)
	return 0;
}

-static void cleanup_rp_race(void)
+static void __exit cleanup_rp_race(void)
{
	unregister_kretprobe(&link_rp);
	unregister_kretprobe(&kfree_rp);
diff -urpN kernel.org/kretprobe_deadlock_bz2162/test.sh kernel.lat/kretprobe_deadlock_bz2162/test.sh
--- kernel.org/kretprobe_deadlock_bz2162/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_deadlock_bz2162/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,7 +11,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=10
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -19,6 +19,9 @@ loglines=10
expr1="Starting kretprobe_deadlock_bz2162 test"
expr2="PASS: kretprobe on kfree unregistered"

+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait
# after loading the test module.
@@ -48,7 +51,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/kretprobe_on_noreturn_bz1345/kretprobe_on_noreturn_bz1345.c kernel.lat/kretprobe_on_noreturn_bz1345/kretprobe_on_noreturn_bz1345.c
--- kernel.org/kretprobe_on_noreturn_bz1345/kretprobe_on_noreturn_bz1345.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_on_noreturn_bz1345/kretprobe_on_noreturn_bz1345.c	2007-03-23 14:36:13.000000000 +0530
@@ -1,6 +1,7 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

MODULE_DESCRIPTION("kretprobe deadlock testing module");
MODULE_AUTHOR("Ananth N Mavinakayanahalli <ananth@in.ibm.com>");
@@ -30,12 +31,16 @@ static struct kretprobe leb_rp = {
	.maxactive = 10
};

-static int init_no_return(void)
+static int __init init_no_return(void)
{
	int ret;

printk("Starting kretprobe_on_noretrun_bz1345 test\n");

+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	execve_rp.kp.symbol_name = "do_execve";
+	leb_rp.kp.symbol_name = "load_elf_binary";
+#else
#ifdef CONFIG_PPC64
	execve_rp.kp.addr = (kprobe_opcode_t *)
				kallsyms_lookup_name(".do_execve");
@@ -47,6 +52,7 @@ static int init_no_return(void)
	leb_rp.kp.addr = (kprobe_opcode_t *)
				kallsyms_lookup_name("load_elf_binary");
#endif
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

	ret = register_kretprobe(&execve_rp);
	if (ret) {
@@ -64,7 +70,7 @@ static int init_no_return(void)
	return 0;
}

-static void cleanup_no_return(void)
+static void __exit cleanup_no_return(void)
{
	unregister_kretprobe(&execve_rp);
	unregister_kretprobe(&leb_rp);
diff -urpN kernel.org/kretprobe_on_noreturn_bz1345/test.sh kernel.lat/kretprobe_on_noreturn_bz1345/test.sh
--- kernel.org/kretprobe_on_noreturn_bz1345/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_on_noreturn_bz1345/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,7 +11,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=4
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -19,6 +19,9 @@ loglines=4
expr1="bz1345 test"
expr2="PASS\|FAIL"

+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait
# after loading the test module.
@@ -48,7 +51,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/kretprobe_recycle_bz2183/kretprobe_recycle_bz2183.c kernel.lat/kretprobe_recycle_bz2183/kretprobe_recycle_bz2183.c
--- kernel.org/kretprobe_recycle_bz2183/kretprobe_recycle_bz2183.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_recycle_bz2183/kretprobe_recycle_bz2183.c	2007-03-23 14:36:13.000000000 +0530
@@ -1,9 +1,9 @@
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/kallsyms.h>
#include <linux/kprobes.h>
+#include <linux/version.h>

struct probe_info {
	const char *fname;
@@ -41,11 +41,15 @@ static int register_probes(struct probe_
{
	int ret;

-	pi->kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name(pi->fname);
-	if (! pi->kp.addr) {
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	pi->kp.symbol_name = pi->fname;
+#else
+	pi->kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(pi->fname);
+	if (!pi->kp.addr) {
		printk(KERN_ERR "Unknown function %s\n", pi->fname);
		return -1;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

	pi->kp.pre_handler = kp_handler;
	ret = register_kprobe(&pi->kp);
@@ -101,9 +105,11 @@ static void __exit rp_exit(void)
	struct probe_info *pi;
	for (pi = probes; pi->fname; pi++) {
		if (pi->rp.nmissed)
-			printk("Failed: %s: %d calls, %d returns, %d missed\n", pi->fname, pi->ncalls, pi->nret, pi->rp.nmissed);
+			printk("Failed: %s: %d calls, %d returns, %d missed\n",
+				pi->fname, pi->ncalls, pi->nret, pi->rp.nmissed);
		else
-			printk("Passed: %s: kretprobe %d missed\n", pi->fname, pi->rp.nmissed);
+			printk("Passed: %s: kretprobe %d missed\n",
+					pi->fname, pi->rp.nmissed);
	}
	unregister_all();
}
diff -urpN kernel.org/kretprobe_recycle_bz2183/test.sh kernel.lat/kretprobe_recycle_bz2183/test.sh
--- kernel.org/kretprobe_recycle_bz2183/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_recycle_bz2183/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -12,7 +12,7 @@ ARCH=`uname -m`
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=3
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -25,6 +25,9 @@ expr1="Registering probes for schedule"
expr2="Passed: schedule: kretprobe 0 missed"
fi

+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait
# after loading the test module.
@@ -53,7 +56,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452.c kernel.lat/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452.c
--- kernel.org/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452.c	2007-03-23 14:36:13.000000000 +0530
@@ -4,6 +4,7 @@
#include <linux/kallsyms.h>
#include <linux/sched.h>
#include <linux/mm.h>
+#include <linux/version.h>

extern void my_test_reentrant_export_function(void);
static unsigned long long rpct;
@@ -21,17 +22,22 @@ int rp_pre(struct kretprobe_instance *ri
	return 0;
}

-int init_module(void)
+static int __init init_kpmod(void)
{
	rp.handler = rp_pre;
	rp.maxactive = 1024;
-	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(func);

+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	rp.kp.symbol_name = func;
+#else
+	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(func);
	if (!rp.kp.addr) {
		printk("Couldn't find addresses to plant probe\n");
		return -1;
	}
-	if ( register_kretprobe(&rp) < 0) {
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
+	if (register_kretprobe(&rp) < 0) {
		printk("register_probe failed\n");
		return -1;
	}
@@ -39,10 +45,12 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	printk("PASSED: kretprobe for schedule unregistered\n");
	unregister_kretprobe(&rp);
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452_reent.c kernel.lat/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452_reent.c
--- kernel.org/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452_reent.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_reentrancy_bz2452/kretprobe_reentrancy_bz2452_reent.c	2007-03-23 14:36:13.000000000 +0530
@@ -4,6 +4,7 @@
#include <linux/kallsyms.h>
#include <linux/sched.h>
#include <linux/mm.h>
+#include <linux/version.h>

static unsigned long long rpct;
static struct kretprobe rp;
@@ -15,20 +16,27 @@ int rp_pre(struct kretprobe_instance *ri
	return 0;
}

-int init_module(void)
+static int __init init_kpmod(void)
{
	rp.handler = rp_pre;
	rp.maxactive = 1024;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	rp.kp.symbol_name = "my_test_reentrant_export_function";
+#else
#if defined (__ppc64__) || defined (__powerpc__)
-	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name(".my_test_reentrant_export_function");
+	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name
+				(".my_test_reentrant_export_function");
#else
-	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name("my_test_reentrant_export_function");
-
+	rp.kp.addr = (kprobe_opcode_t*)kallsyms_lookup_name
+				("my_test_reentrant_export_function");
#endif
	if (!rp.kp.addr) {
		printk("Couldn't find addresses to plant probe\n");
		return -1;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
	if (register_kretprobe(&rp) < 0) {
		printk("register_probe failed\n");
		return -1;
@@ -36,9 +44,11 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	unregister_kretprobe(&rp);
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/kretprobe_reentrancy_bz2452/test.sh kernel.lat/kretprobe_reentrancy_bz2452/test.sh
--- kernel.org/kretprobe_reentrancy_bz2452/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_reentrancy_bz2452/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,7 +11,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=3
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -19,6 +19,9 @@ loglines=3
expr1="kretprobe for schedule registered successfully"
expr2="PASSED: kretprobe for schedule unregistered"

+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait
# after loading the test module.
@@ -49,7 +52,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/kretprobe_switch_to_bz2068/kretprobe_switch_to_bz2068.c kernel.lat/kretprobe_switch_to_bz2068/kretprobe_switch_to_bz2068.c
--- kernel.org/kretprobe_switch_to_bz2068/kretprobe_switch_to_bz2068.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_switch_to_bz2068/kretprobe_switch_to_bz2068.c	2007-03-23 14:36:13.000000000 +0530
@@ -1,6 +1,7 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

MODULE_DESCRIPTION("kretprobe deadlock testing module");
MODULE_AUTHOR("Ananth N Mavinakayanahalli <ananth@in.ibm.com>");
@@ -18,12 +19,15 @@ static struct kretprobe switch_to_rp = {
	.maxactive = 10
};

-static int init_rp_switch_to(void)
+static int __init init_rp_switch_to(void)
{
	int ret;

printk("Starting kretprobe_switch_to_bz2068 test\n");

+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	switch_to_rp.kp.symbol_name = "__switch_to";
+#else
#ifdef CONFIG_PPC64
	switch_to_rp.kp.addr = (kprobe_opcode_t *)
			kallsyms_lookup_name(".__switch_to");
@@ -31,6 +35,7 @@ static int init_rp_switch_to(void)
	switch_to_rp.kp.addr = (kprobe_opcode_t *)
			kallsyms_lookup_name("__switch_to");
#endif
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

	ret = register_kretprobe(&switch_to_rp);
	if (ret) {
@@ -41,7 +46,7 @@ static int init_rp_switch_to(void)
	return 0;
}

-static void cleanup_rp_switch_to(void)
+static void __exit cleanup_rp_switch_to(void)
{
	unregister_kretprobe(&switch_to_rp);
	printk("PASS: kretprobe on __switch_to unregistered\n");
diff -urpN kernel.org/kretprobe_switch_to_bz2068/test.sh kernel.lat/kretprobe_switch_to_bz2068/test.sh
--- kernel.org/kretprobe_switch_to_bz2068/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kretprobe_switch_to_bz2068/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,16 +11,19 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=5
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
#
expr1="Starting kretprobe_switch_to_bz2068 test"
expr2="PASS\|FAIL"
-SUPPORTED_ARCHS="i386 x86_64 ppc64"
+SUPPORTED_ARCHS="i386 ppc64"
ARCHITECTURE=`/bin/uname -i`

+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
check_supported_arch()
{
	# This test should only run on x86_64 and i686 machines.
@@ -66,7 +69,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/kzalloc_crash_bz1813/kzalloc_crash_bz1813.c kernel.lat/kzalloc_crash_bz1813/kzalloc_crash_bz1813.c
--- kernel.org/kzalloc_crash_bz1813/kzalloc_crash_bz1813.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kzalloc_crash_bz1813/kzalloc_crash_bz1813.c	2007-03-23 14:36:13.000000000 +0530
@@ -5,6 +5,7 @@
#include <linux/kernel.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

static struct kprobe kp1, kp2, kp3;
static int count_kzalloc1[NR_CPUS], count_kzalloc2[NR_CPUS], count_kzalloc3[NR_CPUS];
@@ -31,7 +32,7 @@ int kzalloc3_pre_handler(struct kprobe *
	return 0;
}

-static int init_kzalloc_test(void)
+static int __init init_kzalloc_test(void)
{
	int ret;

@@ -46,6 +47,9 @@ static int init_kzalloc_test(void)
	/*
	 * specify the address/offset where you want to insert probes.
	 */
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	kp1.symbol_name = kp2.symbol_name = kp3.symbol_name = "__kzalloc";
+#else
#if defined (__ppc64__) || defined (__powerpc__)
	kp1.addr = (kprobe_opcode_t *)kallsyms_lookup_name(".__kzalloc");
	if (!kp1.addr) {
@@ -66,6 +70,7 @@ static int init_kzalloc_test(void)
	}
#endif
	kp2.addr = kp3.addr = kp1.addr;
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

	ret = register_kprobe(&kp1);
	if (ret) {
@@ -91,7 +96,7 @@ static int init_kzalloc_test(void)
	return 0;
}

-static void cleanup_kzalloc_test(void)
+static void __exit cleanup_kzalloc_test(void)
{
	unregister_kprobe(&kp3);
	printk("PASS: kprobe 3 on __kzalloc unregistered\n");
diff -urpN kernel.org/kzalloc_crash_bz1813/test.sh kernel.lat/kzalloc_crash_bz1813/test.sh
--- kernel.org/kzalloc_crash_bz1813/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/kzalloc_crash_bz1813/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -12,7 +12,7 @@ ARCH=`uname -m`
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=10
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -20,6 +20,10 @@ loglines=10
expr1="Starting kzalloc_crash_bz1813 test"
expr2="PASS\|FAIL"

+
+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
#
# User could pass in the number of seconds, he wants to this test to wait
# after loading the test module.
@@ -49,7 +53,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/probe-examples/jprobe-example.c kernel.lat/probe-examples/jprobe-example.c
--- kernel.org/probe-examples/jprobe-example.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/probe-examples/jprobe-example.c	2007-03-23 14:36:13.000000000 +0530
@@ -5,6 +5,7 @@
#include <linux/uio.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

/*
 * Jumper probe for do_fork.
@@ -29,9 +30,13 @@ static struct jprobe my_jprobe = {
	.entry = (kprobe_opcode_t *) jdo_fork
};

-int init_module(void)
+static int __init init_jpmod(void)
{
	int ret;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	my_jprobe.kp.symbol_name = "do_fork";
+#else
#ifdef __powerpc64__
	my_jprobe.kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name(".do_fork");
#else
@@ -41,8 +46,10 @@ int init_module(void)
		printk("Couldn't find %s to plant jprobe\n", "do_fork");
		return -1;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */

-	if ((ret = register_jprobe(&my_jprobe)) <0) {
+	ret = register_jprobe(&my_jprobe);
+	if (ret < 0) {
		printk("register_jprobe failed, returned %d\n", ret);
		return -1;
	}
@@ -51,10 +58,12 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_jpmod(void)
{
	unregister_jprobe(&my_jprobe);
	printk("jprobe unregistered\n");
}

+module_init(init_jpmod)
+module_exit(cleanup_jpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/probe-examples/kprobe-example.c kernel.lat/probe-examples/kprobe-example.c
--- kernel.org/probe-examples/kprobe-example.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/probe-examples/kprobe-example.c	2007-03-23 14:36:13.000000000 +0530
@@ -4,6 +4,7 @@
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
#include <linux/sched.h>
+#include <linux/version.h>

/*For each probe you need to allocate a kprobe structure*/
static struct kprobe kp;
@@ -14,11 +15,13 @@ int handler_pre(struct kprobe *p, struct
#if defined (__ppc64__) || defined (__powerpc__)
printk("pre_handler: p->addr=0x%p, nip=%lx, lr=%lx\n",
p->addr, regs->nip, regs->link);
+#elif defined (__x86_64__) + printk("pre_handler: p->addr=0x%p, rip=%lx, eflags=0x%lx\n",
+ p->addr, regs->rip, regs->eflags);
#else
printk("pre_handler: p->addr=0x%p, eip=%lx, eflags=0x%lx\n",
p->addr, regs->eip, regs->eflags);
#endif
- dump_stack();
return 0;
}


@@ -46,12 +49,17 @@ int handler_fault(struct kprobe *p, stru
	return 0;
}

-int init_module(void)
+static int __init init_kpmod(void)
{
	int ret;
+
	kp.pre_handler = handler_pre;
	kp.post_handler = handler_post;
	kp.fault_handler = handler_fault;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	kp.symbol_name = "do_fork";
+#else
#ifdef __powerpc64__
	kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name(".do_fork");
#else
@@ -62,7 +70,10 @@ int init_module(void)
		printk("Couldn't find %s to plant kprobe\n", "do_fork");
		return -1;
	}
-	if ((ret = register_kprobe(&kp)) < 0) {
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
+	ret = register_kprobe(&kp);
+	if (ret < 0) {
		printk("register_kprobe failed, returned %d\n", ret);
		return -1;
	}
@@ -70,10 +81,12 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	unregister_kprobe(&kp);
	printk("kprobe unregistered\n");
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/probe-examples/kretprobe-example.c kernel.lat/probe-examples/kretprobe-example.c
--- kernel.org/probe-examples/kretprobe-example.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/probe-examples/kretprobe-example.c	2007-03-23 14:36:13.000000000 +0530
@@ -3,11 +3,12 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

#ifdef __powerpc64__
-static const char *probed_func = ".sys_open";
+static const char *probed_func = ".sys_read";
#else
-static const char *probed_func = "sys_open";
+static const char *probed_func = "sys_read";
#endif

#if defined (__i386__)
@@ -36,15 +37,21 @@ static struct kretprobe my_kretprobe = {
	.maxactive = 20
};

-int init_module(void)
+static int __init init_rpmod(void)
{
	int ret;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	my_kretprobe.kp.symbol_name = probed_func;
+#else
	my_kretprobe.kp.addr =
		(kprobe_opcode_t *) kallsyms_lookup_name(probed_func);
	if (!my_kretprobe.kp.addr) {
		printk("Couldn't find %s to plant return probe\n", probed_func);
		return -1;
	}
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
	if ((ret = register_kretprobe(&my_kretprobe)) < 0) {
		printk("register_kretprobe failed, returned %d\n", ret);
		return -1;
@@ -53,7 +60,7 @@ int init_module(void)
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_rpmod(void)
{
	unregister_kretprobe(&my_kretprobe);
	printk("kretprobe unregistered\n");
@@ -62,4 +69,6 @@ void cleanup_module(void)
		my_kretprobe.nmissed, probed_func);
}

+module_init(init_rpmod)
+module_exit(cleanup_rpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/probe-examples/test.sh kernel.lat/probe-examples/test.sh
--- kernel.org/probe-examples/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/probe-examples/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -5,6 +5,10 @@ testmodules="kprobe-example jprobe-examp

nfail=0

+
+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
check_error()
{
	if test $1 != 0; then
@@ -29,7 +33,7 @@ done
# Build the modules
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test modules."

@@ -53,7 +57,7 @@ do

	# Capture recent output to /var/log/messages.
	sleep 2
-	tail +$old_log_len /var/log/messages > $testresult
+	tail -n +$old_log_len /var/log/messages > $testresult

	# Verify that the expected phrases show up in /var/log/messages.
	../verify_patterns.sh $testmodule.patterns $testresult
diff -urpN kernel.org/probing_module_fn_bz1954/probing_module_fn_bz1954.c kernel.lat/probing_module_fn_bz1954/probing_module_fn_bz1954.c
--- kernel.org/probing_module_fn_bz1954/probing_module_fn_bz1954.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/probing_module_fn_bz1954/probing_module_fn_bz1954.c	2007-03-23 14:36:13.000000000 +0530
@@ -4,6 +4,8 @@
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
#include <linux/sched.h>
+#include <linux/version.h>
+
static int g_count = 0;

int bz1954_selfprobe_test_function(void)
@@ -28,6 +30,9 @@ int handler_pre(struct kprobe *p, struct
#elif defined (__ppc64__) || defined (__powerpc__)
	printk("pre_handler: p->addr=0x%p, nip=%lx, lr=%lx\n",
		 p->addr, regs->nip, regs->link);
+#elif defined (__x86_64__)
+	printk("pre_handler: p->addr=0x%p, rip=%lx, eflags=0x%lx\n",
+		p->addr, regs->rip, regs->eflags);
#else
	printk("pre_handler: p->addr=0x%p, eip=%lx, eflags=0x%lx\n",
		p->addr, regs->eip, regs->eflags);
@@ -64,25 +69,40 @@ int handler_fault(struct kprobe *p, stru

extern int probed_module_test_function(void);

-int init_module(void)
+static int __init init_kpmod(void)
{
	int ret, ret1;
+
	kp.pre_handler = kp1.pre_handler = handler_pre;
	kp.post_handler = kp1.post_handler = handler_post;
	kp.fault_handler = kp1.fault_handler = handler_fault;
+
+#ifndef  USE_KALLSYMS_LOOKUP_NAME
+	kp.symbol_name = "bz1954_selfprobe_test_function";
+	kp1.symbol_name = "probed_module_test_function";
+#else
#ifdef __powerpc64__
-	kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name(".bz1954_selfprobe_test_function");
-	kp1.addr = (kprobe_opcode_t*) kallsyms_lookup_name(".probed_module_test_function");
+	kp.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name(".bz1954_selfprobe_test_function");
+	kp1.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name(".probed_module_test_function");
#else
-	kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name("bz1954_selfprobe_test_function");
-	kp1.addr = (kprobe_opcode_t*) kallsyms_lookup_name("probed_module_test_function");
+	kp.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name("bz1954_selfprobe_test_function");
+	kp1.addr = (kprobe_opcode_t *)
+		kallsyms_lookup_name("probed_module_test_function");
#endif
	/* register the kprobe now */
	if (!kp.addr || !kp1.addr) {
-		printk("Couldn't find %s to plant kprobe\n", "bz1954_selfprobe_test_function");
+		printk("Couldn't find %s to plant kprobe\n",
+				"bz1954_selfprobe_test_function");
		return -1;
	}
-	if (((ret = register_kprobe(&kp)) < 0) || ((ret1 = register_kprobe(&kp1)) < 0)) {
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
+
+	ret = register_kprobe(&kp);
+	ret1 = register_kprobe(&kp1);
+	if ((ret < 0) || (ret1 < 0)) {
		unregister_kprobe(&kp);
		unregister_kprobe(&kp1);
		printk("register_kprobe failed, returned %d\n", ret);
@@ -94,15 +114,17 @@ int init_module(void)
	if (bz1954_selfprobe_test_function() == 0 && g_count > 0)
		printk("self probing worked!!\n");
	probed_module_test_function();
-	
+
	return 0;
}

-void cleanup_module(void)
+static void __exit cleanup_kpmod(void)
{
	unregister_kprobe(&kp);
	unregister_kprobe(&kp1);
	printk("bz1954 kprobe unregistered\n");
}

+module_init(init_kpmod)
+module_exit(cleanup_kpmod)
MODULE_LICENSE("GPL");
diff -urpN kernel.org/probing_module_fn_bz1954/test.sh kernel.lat/probing_module_fn_bz1954/test.sh
--- kernel.org/probing_module_fn_bz1954/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/probing_module_fn_bz1954/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -12,7 +12,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=9
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
@@ -20,6 +20,10 @@ loglines=9
expr1="self probing worked!!"
expr2="probed_module_test_function"

+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
+
#
# User could pass in the number of seconds, he wants to this test to wait # after loading the test module.
@@ -50,7 +54,7 @@ fi
# Build the module
#
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1


check_error $? "Failed to build the test module."
#
diff -urpN kernel.org/runtests.sh kernel.lat/runtests.sh
--- kernel.org/runtests.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/runtests.sh	2007-03-23 14:37:01.000000000 +0530
@@ -2,7 +2,7 @@

# find each directory with the automatic script
tests=`find -path "*/test.sh"`
-
+chmod +x ./kallsyms.sh
for test in $tests
do
	DIR=`/usr/bin/dirname $test`
diff -urpN kernel.org/stolen_int/test.sh kernel.lat/stolen_int/test.sh
--- kernel.org/stolen_int/test.sh	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/stolen_int/test.sh	2007-03-23 14:36:13.000000000 +0530
@@ -11,7 +11,7 @@ testresult=/tmp/${testname}.result
# Capture the last n messages of /var/log/messages that your test would log.
# In general, if your test logs 20 messages this should be 25 or 30.
#
-loglines=20
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# These matching partterns are used to capture the ${testname}.result file,
# expr1 must be matched first in order to capture messages would match expr2
diff -urpN kernel.org/temp_disarm/temp_disarm.c kernel.lat/temp_disarm/temp_disarm.c
--- kernel.org/temp_disarm/temp_disarm.c	2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/temp_disarm/temp_disarm.c	2007-03-23 14:36:13.000000000 +0530
@@ -30,6 +30,7 @@
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/kallsyms.h>
+#include <linux/version.h>

MODULE_DESCRIPTION("Kprobe temp disarm testing Module");
MODULE_AUTHOR("Will Cohen <wcohen@redhat.com>");
@@ -64,7 +65,7 @@ static void clear_counts(void)
{
	int j;

-	for (j=0; j< PROBES_DEPTH; ++j) {
+	for (j = 0; j < PROBES_DEPTH; ++j) {
		kprobe_triggers[j] = 0;
		kprobe_pre[j] = 0;
		kprobe_post[j] = 0;
@@ -76,7 +77,7 @@ static void probe_count_check(int value)
	int j;

	/* check to make sure no changes in counts */
-	for (j=0; j< PROBES_DEPTH; ++j) {
+	for (j = 0; j < PROBES_DEPTH; ++j) {
		is_pass(kprobe_pre[j] == value);
		printk("%s: kprobe_pre[%d] expected %d == act %d\n",
			       result_string, j, value, kprobe_pre[j]);
@@ -141,7 +142,7 @@ static void test0(void)
	int i;

	/* verify that a kprobe does not trigger another kprobe */
-	for (i=0; i<LOOPS; ++i)
+	for (i = 0; i < LOOPS; ++i)
		do_nothing0();
}

@@ -150,12 +151,12 @@ static void test1(void)
	int i;

	/* verify that a kprobe on do_nothing1 still works */
-	for (i=0; i<LOOPS; ++i)
+	for (i = 0; i < LOOPS; ++i)
		do_nothing1();
}


-static struct kprobe kp[] ={ +static struct kprobe kp[] = { { .pre_handler = handler_pre0, .post_handler = handler_post0, @@ -175,23 +176,31 @@ static int __init temp_disarm_init(void) printk("Starting temp-disarm probe test\n");

/* install the probes */
- for (j=0; j< PROBES_DEPTH; ++j) {
+ for (j = 0; j < PROBES_DEPTH; ++j) {
if (j == 0) {
-#if defined (__powerpc64__)
+#ifndef USE_KALLSYMS_LOOKUP_NAME
+ kp[j].symbol_name = "do_nothing0";
+#else
+#ifdef CONFIG_PPC64
kp[j].addr = (kprobe_opcode_t *)
kallsyms_lookup_name(".do_nothing0");
#else
kp[j].addr = (kprobe_opcode_t *)
kallsyms_lookup_name("do_nothing0");
#endif
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
} if ( j == 1) {
-#if defined (__powerpc64__)
- kp[j].addr = (kprobe_opcode_t *) +#ifndef USE_KALLSYMS_LOOKUP_NAME
+ kp[j].symbol_name = "do_nothing1";
+#else
+#ifdef CONFIG_PPC64
+ kp[j].addr = (kprobe_opcode_t *)
kallsyms_lookup_name(".do_nothing1");
#else
- kp[j].addr = (kprobe_opcode_t *) + kp[j].addr = (kprobe_opcode_t *)
kallsyms_lookup_name("do_nothing1");
#endif
+#endif /* USE_KALLSYMS_LOOKUP_NAME */
}
result = register_kprobe(&(kp[j]));
if (result) {
@@ -199,7 +208,7 @@ static int __init temp_disarm_init(void)
++failures;
}
}
-
+
clear_counts();
test0();
is_pass(kprobe_triggers[0] == LOOPS && kprobe_triggers[1] == LOOPS &&
@@ -215,7 +224,7 @@ static int __init temp_disarm_init(void)
printk("%s: probe-enabled\n", result_string);


	/* remove the probes */
-	for (j=0; j< PROBES_DEPTH; ++j) {
+	for (j = 0; j < PROBES_DEPTH; ++j) {
		/* no check to determine whether
		 * unregister_kprobe successful */
		unregister_kprobe(&(kp[j]));
@@ -237,7 +246,7 @@ static int __init temp_disarm_init(void)
	/* check to make sure no changes in counts */
	probe_count_check(0);

- if (passes) + if (passes)
printk("PASSES: %d\n", passes);
if (failures)
printk("FAILURES: %d\n", failures);
diff -urpN kernel.org/temp_disarm/test.sh kernel.lat/temp_disarm/test.sh
--- kernel.org/temp_disarm/test.sh 2007-03-23 14:35:39.000000000 +0530
+++ kernel.lat/temp_disarm/test.sh 2007-03-23 14:36:13.000000000 +0530
@@ -4,12 +4,16 @@ testname=temp_disarm
testmodule=temp_disarm
TESTRESULT=../getresult.sh
testresult=/tmp/${testname}.result
-loglines=20
+loglines=`wc -l /var/log/messages | awk '{print $1}'`
#
# Matching parttern in the log
expr1="Starting temp-disarm probe test"
expr2="PASS\|FAIL"


+
+#set special compile flag if function kallsyms_lookup_name is exported.
+MCFLAGS=`../kallsyms.sh`
+
check_error()
{
	if test $1 != 0; then
@@ -25,7 +29,7 @@ if [ $? -eq "0" ]; then
fi
# Build the module
make clean > /dev/null 2>&1
-make > /dev/null 2>&1
+make ${MCFLAGS} > /dev/null 2>&1

check_error $? "Failed to build the test module."



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]