[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130311142233.19885.10567.stgit@mhiramat-M0-7522>
Date: Mon, 11 Mar 2013 23:22:33 +0900
From: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
To: Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Cc: Timo Juhani Lindfors <timo.lindfors@....fi>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Pavel Emelyanov <xemul@...allels.com>,
Jiri Kosina <jkosina@...e.cz>,
Nadia Yvette Chambers <nyc@...omorphy.com>,
yrl.pp-manager.tt@...achi.com,
"David S. Miller" <davem@...emloft.net>
Subject: [PATCH -tip ] [BUGFIX] kprobes: Move hash_64() into .text.kprobe
section
Beacuse hash_64() is called from the get_kprobe() inside
int3 handler, kernel causes int3 recursion and crashes if
kprobes user puts a probe on it.
Usually hash_64() is inlined into caller function, but in
some cases, it has instances by gcc's interprocedural
constant propagation.
This patch adds __kprobes tag on the hash_64() and moves
all those instances into .text.kprobe section so that
kprobes can refuse probing on the instances.
I've ensured that all hash_64 instances moves to the
address between __kprobes_text_start and __kprobes_text_end
with this patch as below.
ffffffff8138bea0 T __kprobes_text_start
ffffffff8138bec0 t hash_64.constprop.8
ffffffff8138ef98 t hash_64.constprop.26
ffffffff8138efae t hash_64
ffffffff8138f066 t hash_64.constprop.43
ffffffff8138f649 t hash_64.constprop.25
ffffffff8139103a t hash_64.constprop.77
ffffffff81391050 t hash_64.constprop.24
ffffffff81391066 t hash_64.constprop.40
ffffffff8139107c t hash_64.constprop.15
ffffffff81391092 T __kprobes_text_end
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Reported-by: Timo Juhani Lindfors <timo.lindfors@....fi>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Nadia Yvette Chambers <nyc@...omorphy.com>
Cc: Pavel Emelyanov <xemul@...allels.com>
Cc: Jiri Kosina <jkosina@...e.cz>
Cc: Ananth N Mavinakayanahalli <ananth@...ibm.com>
---
include/linux/hash.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/hash.h b/include/linux/hash.h
index 61c97ae..d83f62f 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -15,6 +15,7 @@
*/
#include <asm/types.h>
+#include <linux/kprobes.h>
/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
#define GOLDEN_RATIO_PRIME_32 0x9e370001UL
@@ -31,7 +32,7 @@
#error Wordsize not 32 or 64
#endif
-static inline u64 hash_64(u64 val, unsigned int bits)
+static __kprobes inline u64 hash_64(u64 val, unsigned int bits)
{
u64 hash = val;
--
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