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-4554dbcb85a4ed2abaa2b6fa15649b796699ec89@git.kernel.org>
Date:	Thu, 4 Feb 2010 09:55:40 GMT
From:	tip-bot for Masami Hiramatsu <mhiramat@...hat.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
	jkenisto@...ibm.com, ananth@...ibm.com,
	dle-develop@...ts.sourceforge.net, fweisbec@...il.com,
	rostedt@...dmis.org, compudj@...stal.dyndns.org, jbaron@...hat.com,
	tglx@...utronix.de, mhiramat@...hat.com, mingo@...e.hu,
	systemtap@...rces.redhat.com
Subject: [tip:perf/core] kprobes: Check probe address is reserved

Commit-ID:  4554dbcb85a4ed2abaa2b6fa15649b796699ec89
Gitweb:     http://git.kernel.org/tip/4554dbcb85a4ed2abaa2b6fa15649b796699ec89
Author:     Masami Hiramatsu <mhiramat@...hat.com>
AuthorDate: Tue, 2 Feb 2010 16:49:18 -0500
Committer:  Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 4 Feb 2010 09:36:19 +0100

kprobes: Check probe address is reserved

Check whether the address of new probe is already reserved by
ftrace or alternatives (on x86) when registering new probe.
If reserved, it returns an error and not register the probe.

Signed-off-by: Masami Hiramatsu <mhiramat@...hat.com>
Cc: systemtap <systemtap@...rces.redhat.com>
Cc: DLE <dle-develop@...ts.sourceforge.net>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: przemyslaw@...elczyk.it
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ananth N Mavinakayanahalli <ananth@...ibm.com>
Cc: Jim Keniston <jkenisto@...ibm.com>
Cc: Mathieu Desnoyers <compudj@...stal.dyndns.org>
Cc: Jason Baron <jbaron@...hat.com>
LKML-Reference: <20100202214918.4694.94179.stgit@...p-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
 arch/x86/kernel/kprobes.c |    3 +++
 kernel/kprobes.c          |    4 +++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 9453815..5de9f4a 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -337,6 +337,9 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
 
 int __kprobes arch_prepare_kprobe(struct kprobe *p)
 {
+	if (alternatives_text_reserved(p->addr, p->addr))
+		return -EINVAL;
+
 	if (!can_probe((unsigned long)p->addr))
 		return -EILSEQ;
 	/* insn: must be on special executable page on x86. */
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 9907a03..c3340e8 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -44,6 +44,7 @@
 #include <linux/debugfs.h>
 #include <linux/kdebug.h>
 #include <linux/memory.h>
+#include <linux/ftrace.h>
 
 #include <asm-generic/sections.h>
 #include <asm/cacheflush.h>
@@ -703,7 +704,8 @@ int __kprobes register_kprobe(struct kprobe *p)
 
 	preempt_disable();
 	if (!kernel_text_address((unsigned long) p->addr) ||
-	    in_kprobes_functions((unsigned long) p->addr)) {
+	    in_kprobes_functions((unsigned long) p->addr) ||
+	    ftrace_text_reserved(p->addr, p->addr)) {
 		preempt_enable();
 		return -EINVAL;
 	}
--
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