lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-05662bdb64c746079de7ac4dc4fb4caa5e8e119f@git.kernel.org>
Date:	Wed, 15 Sep 2010 10:04:32 GMT
From:	tip-bot for Namhyung Kim <namhyung@...il.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
	masami.hiramatsu.pt@...achi.com, tglx@...utronix.de,
	namhyung@...il.com, mingo@...e.hu
Subject: [tip:perf/core] kprobes: Verify jprobe entry point

Commit-ID:  05662bdb64c746079de7ac4dc4fb4caa5e8e119f
Gitweb:     http://git.kernel.org/tip/05662bdb64c746079de7ac4dc4fb4caa5e8e119f
Author:     Namhyung Kim <namhyung@...il.com>
AuthorDate: Wed, 15 Sep 2010 10:04:27 +0900
Committer:  Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 15 Sep 2010 10:44:01 +0200

kprobes: Verify jprobe entry point

Verify jprobe's entry point is a function entry point
using kallsyms' offset value.

Signed-off-by: Namhyung Kim <namhyung@...il.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
LKML-Reference: <1284512670-2369-3-git-send-email-namhyung@...il.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
 kernel/kprobes.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 8f96701..1b0dbe0 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1339,14 +1339,18 @@ int __kprobes register_jprobes(struct jprobe **jps, int num)
 	if (num <= 0)
 		return -EINVAL;
 	for (i = 0; i < num; i++) {
-		unsigned long addr;
+		unsigned long addr, offset;
 		jp = jps[i];
 		addr = arch_deref_entry_point(jp->entry);
 
-		/* Todo: Verify probepoint is a function entry point */
-		jp->kp.pre_handler = setjmp_pre_handler;
-		jp->kp.break_handler = longjmp_break_handler;
-		ret = register_kprobe(&jp->kp);
+		/* Verify probepoint is a function entry point */
+		if (kallsyms_lookup_size_offset(addr, NULL, &offset) &&
+		    offset == 0) {
+			jp->kp.pre_handler = setjmp_pre_handler;
+			jp->kp.break_handler = longjmp_break_handler;
+			ret = register_kprobe(&jp->kp);
+		} else
+			ret = -EINVAL;
 
 		if (ret < 0) {
 			if (i > 0)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ