linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jprobes: Ensure that the probepoint is at function entry
@ 2017-06-29 14:56 Naveen N. Rao
  2017-07-05 10:42 ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Naveen N. Rao @ 2017-06-29 14:56 UTC (permalink / raw)
  To: Masami Hiramatsu, Ingo Molnar; +Cc: Ananth N Mavinakayanahalli, linux-kernel

Similar to commit 90ec5e89e393c ("kretprobes: Ensure probe location is
at function entry"), ensure that the jprobe probepoint is at function
entry.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 kernel/kprobes.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index adfe3b4cfe05..950018609339 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1776,9 +1776,14 @@ int register_jprobes(struct jprobe **jps, int num)
 		jp = jps[i];
 		addr = arch_deref_entry_point(jp->entry);
 
-		/* Verify probepoint is a function entry point */
+		/*
+		 * Verify probepoint as well as the jprobe handler are
+		 * function entry points.
+		 */
 		if (kallsyms_lookup_size_offset(addr, NULL, &offset) &&
-		    offset == 0) {
+				offset == 0 &&
+				function_offset_within_entry(jp->kp.addr,
+					jp->kp.symbol_name, jp->kp.offset)) {
 			jp->kp.pre_handler = setjmp_pre_handler;
 			jp->kp.break_handler = longjmp_break_handler;
 			ret = register_kprobe(&jp->kp);
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-07-07 11:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 14:56 [PATCH] jprobes: Ensure that the probepoint is at function entry Naveen N. Rao
2017-07-05 10:42 ` Ingo Molnar
2017-07-06 10:03   ` Masami Hiramatsu
2017-07-06 12:15     ` Ingo Molnar
2017-07-07  1:02       ` Masami Hiramatsu
2017-07-07 10:49         ` Ingo Molnar
2017-07-07 11:26           ` Naveen N. Rao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).