Re: multiple softdeps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+cifs, +Jean, +Pavel

On Fri, Jun 28, 2019 at 03:16:35PM +0200, Harald Hoyer wrote:
Hi,

could you please enlighten me about kernel module softdeps?

$ modinfo cifs | grep soft
softdep:        pre: ccm
softdep:        pre: aead2
softdep:        pre: sha512
softdep:        pre: sha256
softdep:        pre: cmac
softdep:        pre: aes
softdep:        pre: nls
softdep:        pre: md5
softdep:        pre: md4
softdep:        pre: hmac
softdep:        pre: ecb
softdep:        pre: des
softdep:        pre: arc4

$ grep cifs /lib/modules/$(uname -r)/modules.softdep
softdep cifs pre: ccm
softdep cifs pre: aead2
softdep cifs pre: sha512
softdep cifs pre: sha256
softdep cifs pre: cmac
softdep cifs pre: aes
softdep cifs pre: nls
softdep cifs pre: md5
softdep cifs pre: md4
softdep cifs pre: hmac
softdep cifs pre: ecb
softdep cifs pre: des
softdep cifs pre: arc4

this is your bug. Multiple softdeps are not additive to the previous
configuration, we never supported that. Commit b9be76d585d4 ("cifs: Add
soft dependencies") added it for the wrong reasons actually. A sotfdep
means kmod will actually load those dependencies before loading the
module (or fail to load it if those dependencies don't exist).
Besides the wrong commit message, if that is indeed what is desired, the
fix would be:

--------8<--------------
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 65d9771e49f9..4f1f744ea3cd 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1591,18 +1591,6 @@ MODULE_DESCRIPTION
	("VFS to access SMB3 servers e.g. Samba, Macs, Azure and Windows (and "
	"also older servers complying with the SNIA CIFS Specification)");
MODULE_VERSION(CIFS_VERSION);
-MODULE_SOFTDEP("pre: arc4");
-MODULE_SOFTDEP("pre: des");
-MODULE_SOFTDEP("pre: ecb");
-MODULE_SOFTDEP("pre: hmac");
-MODULE_SOFTDEP("pre: md4");
-MODULE_SOFTDEP("pre: md5");
-MODULE_SOFTDEP("pre: nls");
-MODULE_SOFTDEP("pre: aes");
-MODULE_SOFTDEP("pre: cmac");
-MODULE_SOFTDEP("pre: sha256");
-MODULE_SOFTDEP("pre: sha512");
-MODULE_SOFTDEP("pre: aead2");
-MODULE_SOFTDEP("pre: ccm");
+MODULE_SOFTDEP("pre: arc4 des ecb hmac md4 md5 nls aes cmac sha256 sha512 aead2 ccm");
module_init(init_cifs)
module_exit(exit_cifs)
--------8<--------------

I guess we could actually implement additive deps, e.g. by using
"pre+:" or something else. But I think the right thing to do for now is
to apply something like above to cifs and propagate it to stable.

Thanks for the report.

Lucas De Marchi


But, calling kmod_module_get_softdeps() on the cifs module only returns one module in the pre list ("ccm").

Is my understanding about how softdeps work wrong, or is the cifs module misconfigured, or is libkmod buggy?
Please CC me, as I am not subscribed to the mailing list.


softdeps-test.c:

#include <stdio.h>
#include <libkmod.h>
#include <stdlib.h>

int main() {
   int err;
   struct kmod_ctx *ctx = NULL;
   struct kmod_list *list = NULL;
   struct kmod_list *modpre = NULL;
   struct kmod_list *modpost = NULL;
   struct kmod_list *itr, *l;

   ctx = kmod_new(NULL, NULL);

   err = kmod_module_new_from_lookup(ctx, "cifs", &list);
   if (err < 0) {
       perror("kmod_module_new_from_lookup");
       return EXIT_FAILURE;
   }

   kmod_list_foreach(l, list) {
       struct kmod_module *mod = NULL;
       mod = kmod_module_get_module(l);

       kmod_module_get_softdeps(mod, &modpre, &modpost);

       kmod_list_foreach(itr, modpre) {
           struct kmod_module *mod = NULL;
           const char *path = NULL;
           mod = kmod_module_get_module(itr);
           path = kmod_module_get_path(mod);
           puts(path);
       }
   }
}



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux