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, 17 Jul 2022 01:17:17 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     x86@...nel.org, Linus Torvalds <torvalds@...ux-foundation.org>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        Andrew Cooper <Andrew.Cooper3@...rix.com>,
        Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
        Johannes Wikner <kwikner@...z.ch>,
        Alyssa Milburn <alyssa.milburn@...ux.intel.com>,
        Jann Horn <jannh@...gle.com>, "H.J. Lu" <hjl.tools@...il.com>,
        Joao Moreira <joao.moreira@...el.com>,
        Joseph Nuzman <joseph.nuzman@...el.com>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: [patch 05/38] btree: Initialize early when builtin

An upcoming user of btree needs it early on. Initialize it in
start_kernel().

Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
 include/linux/btree.h |    6 ++++++
 init/main.c           |    2 ++
 lib/btree.c           |    8 +++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

--- a/include/linux/btree.h
+++ b/include/linux/btree.h
@@ -5,6 +5,12 @@
 #include <linux/kernel.h>
 #include <linux/mempool.h>
 
+#if IS_BUILTIN(CONFIG_BTREE)
+extern void btree_cache_init(void);
+#else
+static inline void btree_cache_init(void) {}
+#endif
+
 /**
  * DOC: B+Tree basics
  *
--- a/init/main.c
+++ b/init/main.c
@@ -75,6 +75,7 @@
 #include <linux/signal.h>
 #include <linux/idr.h>
 #include <linux/kgdb.h>
+#include <linux/btree.h>
 #include <linux/ftrace.h>
 #include <linux/async.h>
 #include <linux/shmem_fs.h>
@@ -1125,6 +1126,7 @@ asmlinkage __visible void __init __no_sa
 	cgroup_init();
 	taskstats_init_early();
 	delayacct_init();
+	btree_cache_init();
 
 	poking_init();
 	check_bugs();
--- a/lib/btree.c
+++ b/lib/btree.c
@@ -787,15 +787,21 @@ static int __init btree_module_init(void
 	return 0;
 }
 
+#if IS_MODULE(CONFIG_BTREE)
 static void __exit btree_module_exit(void)
 {
 	kmem_cache_destroy(btree_cachep);
 }
 
-/* If core code starts using btree, initialization should happen even earlier */
 module_init(btree_module_init);
 module_exit(btree_module_exit);
 
 MODULE_AUTHOR("Joern Engel <joern@...fs.org>");
 MODULE_AUTHOR("Johannes Berg <johannes@...solutions.net>");
 MODULE_LICENSE("GPL");
+#else
+void __init btree_cache_init(void)
+{
+	BUG_ON(btree_module_init());
+}
+#endif

Powered by blists - more mailing lists