File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 25
25
26
26
#include <linux/kprobes.h>
27
27
#include <linux/preempt.h>
28
+ #include <linux/uaccess.h>
28
29
#include <linux/kdebug.h>
29
30
#include <linux/slab.h>
30
31
@@ -118,11 +119,19 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
118
119
union mips_instruction prev_insn ;
119
120
int ret = 0 ;
120
121
121
- prev_insn = p -> addr [-1 ];
122
122
insn = p -> addr [0 ];
123
123
124
- if (insn_has_delayslot (insn ) || insn_has_delayslot (prev_insn )) {
125
- pr_notice ("Kprobes for branch and jump instructions are not supported\n" );
124
+ if (insn_has_delayslot (insn )) {
125
+ pr_notice ("Kprobes for branch and jump instructions are not"
126
+ "supported\n" );
127
+ ret = - EINVAL ;
128
+ goto out ;
129
+ }
130
+
131
+ if ((probe_kernel_read (& prev_insn , p -> addr - 1 ,
132
+ sizeof (mips_instruction )) == 0 ) &&
133
+ insn_has_delayslot (prev_insn )) {
134
+ pr_notice ("Kprobes for branch delayslot are not supported\n" );
126
135
ret = - EINVAL ;
127
136
goto out ;
128
137
}
You can’t perform that action at this time.
0 commit comments