aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/test_kprobes.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/kernel/test_kprobes.c b/kernel/test_kprobes.c
index 06b6395b45b2..9c0127ead6ab 100644
--- a/kernel/test_kprobes.c
+++ b/kernel/test_kprobes.c
@@ -22,21 +22,10 @@
22 22
23static u32 rand1, preh_val, posth_val, jph_val; 23static u32 rand1, preh_val, posth_val, jph_val;
24static int errors, handler_errors, num_tests; 24static int errors, handler_errors, num_tests;
25static u32 (*target)(u32 value);
25 26
26static noinline u32 kprobe_target(u32 value) 27static noinline u32 kprobe_target(u32 value)
27{ 28{
28 /*
29 * gcc ignores noinline on some architectures unless we stuff
30 * sufficient lard into the function. The get_kprobe() here is
31 * just for that.
32 *
33 * NOTE: We aren't concerned about the correctness of get_kprobe()
34 * here; hence, this call is neither under !preempt nor with the
35 * kprobe_mutex held. This is fine(tm)
36 */
37 if (get_kprobe((void *)0xdeadbeef))
38 printk(KERN_INFO "Kprobe smoke test: probe on 0xdeadbeef!\n");
39
40 return (value / div_factor); 29 return (value / div_factor);
41} 30}
42 31
@@ -74,7 +63,7 @@ static int test_kprobe(void)
74 return ret; 63 return ret;
75 } 64 }
76 65
77 ret = kprobe_target(rand1); 66 ret = target(rand1);
78 unregister_kprobe(&kp); 67 unregister_kprobe(&kp);
79 68
80 if (preh_val == 0) { 69 if (preh_val == 0) {
@@ -121,7 +110,7 @@ static int test_jprobe(void)
121 return ret; 110 return ret;
122 } 111 }
123 112
124 ret = kprobe_target(rand1); 113 ret = target(rand1);
125 unregister_jprobe(&jp); 114 unregister_jprobe(&jp);
126 if (jph_val == 0) { 115 if (jph_val == 0) {
127 printk(KERN_ERR "Kprobe smoke test failed: " 116 printk(KERN_ERR "Kprobe smoke test failed: "
@@ -177,7 +166,7 @@ static int test_kretprobe(void)
177 return ret; 166 return ret;
178 } 167 }
179 168
180 ret = kprobe_target(rand1); 169 ret = target(rand1);
181 unregister_kretprobe(&rp); 170 unregister_kretprobe(&rp);
182 if (krph_val != rand1) { 171 if (krph_val != rand1) {
183 printk(KERN_ERR "Kprobe smoke test failed: " 172 printk(KERN_ERR "Kprobe smoke test failed: "
@@ -193,6 +182,8 @@ int init_test_probes(void)
193{ 182{
194 int ret; 183 int ret;
195 184
185 target = kprobe_target;
186
196 do { 187 do {
197 rand1 = random32(); 188 rand1 = random32();
198 } while (rand1 <= div_factor); 189 } while (rand1 <= div_factor);