All of lore.kernel.org
 help / color / mirror / Atom feed
* crypto: libcrc32c should select crc32c
@ 2009-01-17 22:48 Jan Engelhardt
  2009-01-18  5:37 ` Herbert Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2009-01-17 22:48 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto

parent 683fd3522476a2b9e9278d99a7bb367c887faa5a (v2.6.29-rc2-19-g683fd35)
commit db86cb2732110f756b95f7d5a2aa37f35ba67cff
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Sat Jan 17 20:40:45 2009 +0100

crypto: libcrc32c should select crc32c

Whilst trying to make use of btrfs of a root fs with 2.6.29-rc1/rc2,
I get the following output from my initramfs:

	[...]
	Mounting root /dev/sda3
	modprobe: WARNING: Error inserting libcrc32c
	(/lib/modules/2.6.29-rc2-jen73-experimental/kernel/lib/libcrc32c.ko.gz):
	Unknown symbol in module, or unknown parameter (see dmesg)

	<4>btrfs: Unknown symbol crc32c
	modprobe: FATAL: Error inserting btrfs
	(/lib/modules/2.6.29-rc2-jen73-experimental/kernel/fs/btrfs/btrfs.ko.gz):
	Unknown symbol in module, or unknown parameter (see dmesg)

	mount: unknown filesystem type 'btrfs'

Since "unknown symbol crc32c" is the only kernel-reported message,
just what keeps libcrc32c from loading -- especially because it does
not depend on any other symbol from another kernel module according
to modinfo.

Looking at libcrc32c.c shows that it essentially depends on the
crc32c crypto module, which was not packed into my initramfs image
by mkinitrd because.. there is no dependency.

Because a simple Kconfig "select" will not make mkinitrd aware of the
dependency, this patch adds a source-level dep similar to what
Netfilter does with need_conntrack().

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 crypto/crc32c.c        |    6 ++++++
 include/linux/crc32c.h |    1 +
 lib/libcrc32c.c        |    2 ++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/crypto/crc32c.c b/crypto/crc32c.c
index 973bc2c..b3dd3ec 100644
--- a/crypto/crc32c.c
+++ b/crypto/crc32c.c
@@ -242,6 +242,12 @@ static struct shash_alg alg = {
 	}
 };
 
+/* Some modules need us, but do not depend directly on any symbol. */
+void need_crc32c(void)
+{
+}
+EXPORT_SYMBOL_GPL(need_crc32c);
+
 static int __init crc32c_mod_init(void)
 {
 	return crypto_register_shash(&alg);
diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h
index bd8b44d..139416a 100644
--- a/include/linux/crc32c.h
+++ b/include/linux/crc32c.h
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 
+extern void need_crc32c(void);
 extern u32 crc32c(u32 crc, const void *address, unsigned int length);
 
 /* This macro exists for backwards-compatibility. */
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c
index 244f548..948f50a 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -32,6 +32,7 @@
  */
 
 #include <crypto/hash.h>
+#include <linux/crc32c.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -61,6 +62,7 @@ EXPORT_SYMBOL(crc32c);
 
 static int __init libcrc32c_mod_init(void)
 {
+	need_crc32c();
 	tfm = crypto_alloc_shash("crc32c", 0, 0);
 	if (IS_ERR(tfm))
 		return PTR_ERR(tfm);
-- 
# Created with git-export-patch


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

end of thread, other threads:[~2009-01-19 21:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-17 22:48 crypto: libcrc32c should select crc32c Jan Engelhardt
2009-01-18  5:37 ` Herbert Xu
2009-01-18  8:14   ` Jan Engelhardt
2009-01-18 20:45     ` Sam Ravnborg
2009-01-19 19:51       ` Jan Engelhardt
2009-01-19 21:08         ` Herbert Xu
     [not found]     ` <4974D343.3010302@cavium.com>
2009-01-19 19:27       ` RFC 4868 support for Linux IPsec stack Tarun Ahuja

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.