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]
Date:	Sun, 15 Feb 2009 19:20:24 +0100
From:	Andreas Robinson <andr345@...il.com>
To:	sam@...nborg.org, rusty@...tcorp.com.au
Cc:	linux-kernel@...r.kernel.org
Subject: [RFC PATCH 2/6] module: add module ELF section with module_init() pointer

The linker script will append this section to the end of the list
of initcalls so that init/main.c:do_initcalls() can find it.
---
 include/asm-generic/vmlinux.lds.h |    3 ++-
 include/linux/init.h              |   11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index c61fab1..d3c0787 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -428,7 +428,8 @@
   	*(.initcall6.init)						\
   	*(.initcall6s.init)						\
   	*(.initcall7.init)						\
-  	*(.initcall7s.init)
+  	*(.initcall7s.init)						\
+  	*(.mod_initcall.init)
 
 #define PERCPU(align)							\
 	. = ALIGN(align);						\
diff --git a/include/linux/init.h b/include/linux/init.h
index 68cb026..62b854f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -284,11 +284,20 @@ void __init parse_early_param(void);
 
 #define security_initcall(fn)		module_init(fn)
 
+#ifdef CONFIG_MODULE_STATIC
+#define module_initcall(fn) \
+	static initcall_t __initcall_##fn \
+	__used __section(.mod_initcall.init) = fn
+#else
+#define module_initcall(fn)
+#endif
+
 /* Each module must use one module_init(). */
 #define module_init(initfn)					\
 	static inline initcall_t __inittest(void)		\
 	{ return initfn; }					\
-	int init_module(void) __attribute__((alias(#initfn)));
+	int init_module(void) __attribute__((alias(#initfn)));	\
+	module_initcall(initfn);
 
 /* This is only required if you want to be unloadable. */
 #define module_exit(exitfn)					\
-- 
1.5.6.3

--
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