|
@@ -1875,12 +1875,25 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)
|
|
|
}
|
|
|
NOKPROBE_SYMBOL(pre_handler_kretprobe);
|
|
|
|
|
|
+bool __weak arch_function_offset_within_entry(unsigned long offset)
|
|
|
+{
|
|
|
+ return !offset;
|
|
|
+}
|
|
|
+
|
|
|
int register_kretprobe(struct kretprobe *rp)
|
|
|
{
|
|
|
int ret = 0;
|
|
|
struct kretprobe_instance *inst;
|
|
|
int i;
|
|
|
void *addr;
|
|
|
+ unsigned long offset;
|
|
|
+
|
|
|
+ addr = kprobe_addr(&rp->kp);
|
|
|
+ if (!kallsyms_lookup_size_offset((unsigned long)addr, NULL, &offset))
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (!arch_function_offset_within_entry(offset))
|
|
|
+ return -EINVAL;
|
|
|
|
|
|
if (kretprobe_blacklist_size) {
|
|
|
addr = kprobe_addr(&rp->kp);
|