Message ID | 20180303222716.26640-5-alexander.levin@microsoft.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | None | expand |
Hi Sasha, Sasha Levin wrote: > From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> > > [ Upstream commit 90ec5e89e393c76e19afc845d8f88a5dc8315919 ] > Sorry if this is obvious, but why was this patch picked up for -stable? I don't see the upstream commit tagging -stable, so curious why this was done. I don't think this patch should be pushed to -stable since this is not really a bug fix. There are also other dependencies for this change (see commit a64e3f35a45f4a, for instance), including how userspace (perf) builds out the retprobe argument. As such, please drop this from -stable (for 3.18. 4.4 and 4.9). Thanks, Naveen
On Mon, Mar 05, 2018 at 12:32:57PM +0530, Naveen N. Rao wrote: >Hi Sasha, > >Sasha Levin wrote: >>From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> >> >>[ Upstream commit 90ec5e89e393c76e19afc845d8f88a5dc8315919 ] >> > >Sorry if this is obvious, but why was this patch picked up for >-stable? I don't see the upstream commit tagging -stable, so curious >why this was done. > >I don't think this patch should be pushed to -stable since this is not >really a bug fix. There are also other dependencies for this change >(see commit a64e3f35a45f4a, for instance), including how userspace >(perf) builds out the retprobe argument. As such, please drop this >from -stable (for 3.18. 4.4 and 4.9). Hi Naveen, It's an automatic selection process that attempts to find commits that should be in stable but weren't tagged as such. I'll drop this patch, thanks!
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index e23392517db9..56a998f34bdd 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -266,6 +266,7 @@ extern int arch_init_kprobes(void); extern void show_registers(struct pt_regs *regs); extern void kprobes_inc_nmissed_count(struct kprobe *p); extern bool arch_within_kprobe_blacklist(unsigned long addr); +extern bool arch_function_offset_within_entry(unsigned long offset); extern bool within_kprobe_blacklist(unsigned long addr); diff --git a/kernel/kprobes.c b/kernel/kprobes.c index a1a07cf1101f..2ede39e4227f 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1834,12 +1834,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);