public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] [patch 1/2] add non_init_kernel_text_address
@ 2007-12-14  6:55 Srinivasa Ds
  2007-12-14  6:57 ` [RFC] [patch 2/2] Refuse kprobe insertion on __init section code Srinivasa Ds
  2007-12-14  7:09 ` [RFC] [patch 1/2] add non_init_kernel_text_address Andrew Morton
  0 siblings, 2 replies; 15+ messages in thread
From: Srinivasa Ds @ 2007-12-14  6:55 UTC (permalink / raw)
  To: linux-kernel, ananth, Andrew Morton, Masami Hiramatsu,
	Jim Keniston; +Cc: rusty

Since __init functions are discarded and its memory freed once
initialization completes, It would be better if we enable kprobes 
to refuse probing __init functions. The attached patchset will do 
that.

This patch creates non_init_kernel_text_address() to identify
non_init text area.

Iam open to suggestions for a better functionname. 

Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com> 
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>


---
 include/linux/kernel.h |    2 ++
 kernel/extable.c       |   16 +++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

Index: linux-2.6.24-rc5-mm1/include/linux/kernel.h
===================================================================
--- linux-2.6.24-rc5-mm1.orig/include/linux/kernel.h
+++ linux-2.6.24-rc5-mm1/include/linux/kernel.h
@@ -169,6 +169,8 @@ extern unsigned long long memparse(char 
 extern int core_kernel_text(unsigned long addr);
 extern int __kernel_text_address(unsigned long addr);
 extern int kernel_text_address(unsigned long addr);
+extern int non_init_kernel_text_address(unsigned long addr);
+extern int non_init_core_kernel_text(unsigned long addr);
 struct pid;
 extern struct pid *session_of_pgrp(struct pid *pgrp);
 
Index: linux-2.6.24-rc5-mm1/kernel/extable.c
===================================================================
--- linux-2.6.24-rc5-mm1.orig/kernel/extable.c
+++ linux-2.6.24-rc5-mm1/kernel/extable.c
@@ -40,11 +40,18 @@ const struct exception_table_entry *sear
 	return e;
 }
 
-int core_kernel_text(unsigned long addr)
+int non_init_core_kernel_text(unsigned long addr)
 {
 	if (addr >= (unsigned long)_stext &&
 	    addr <= (unsigned long)_etext)
 		return 1;
+	return 0;
+}
+
+int core_kernel_text(unsigned long addr)
+{
+	if (non_init_core_kernel_text(addr))
+		return 1;
 
 	if (addr >= (unsigned long)_sinittext &&
 	    addr <= (unsigned long)_einittext)
@@ -65,3 +72,10 @@ int kernel_text_address(unsigned long ad
 		return 1;
 	return module_text_address(addr) != NULL;
 }
+
+int non_init_kernel_text_address(unsigned long addr)
+{
+	if (non_init_core_kernel_text(addr))
+		return 1;
+	return module_text_address(addr) != NULL;
+}

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

end of thread, other threads:[~2008-01-01  7:05 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14  6:55 [RFC] [patch 1/2] add non_init_kernel_text_address Srinivasa Ds
2007-12-14  6:57 ` [RFC] [patch 2/2] Refuse kprobe insertion on __init section code Srinivasa Ds
2007-12-14  7:09 ` [RFC] [patch 1/2] add non_init_kernel_text_address Andrew Morton
2007-12-14  7:51   ` Ananth N Mavinakayanahalli
2007-12-18  4:57     ` Rusty Russell
2007-12-18  6:46       ` Srinivasa Ds
2007-12-18  7:23         ` Rusty Russell
2007-12-19  5:11           ` Rusty Russell
2008-01-01  6:34             ` Srinivasa Ds
2007-12-14  9:30   ` Srinivasa Ds
2007-12-14 10:17     ` Srinivasa Ds
2007-12-14 12:46       ` Johannes Weiner
2007-12-17 10:15         ` Srinivasa Ds
2007-12-17 10:20           ` [RFC] [patch 2/2] Refuse kprobe insertion on __init section code Srinivasa Ds
2007-12-14  9:34   ` Srinivasa Ds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox