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] [day] [month] [year] [list]
Message-ID: <CAMhs6YxAQH+xzw72cmA7NjwYGD0qkOa4G0QHa7WwVWEt0xoFvw@mail.gmail.com>
Date:	Sat, 10 Dec 2011 08:03:21 +0200
From:	Maxin B John <maxin.john@...il.com>
To:	Felipe Contreras <felipe.contreras@...il.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Is there something like MODULE_DEPEND?

Hi Felipe,

On Sat, Dec 10, 2011 at 6:08 AM, Felipe Contreras
<felipe.contreras@...il.com> wrote:
> Hi,
>
> So I've finally found that my problem was that I have to load module
> B, before loading module A. The dependency is in the Kconfig file, but
> module A doesn't use any symbols from module B, so it's not
> automatically loaded.

>From this, I think  you are looking for the "request_module()".

> Apparently FreeBSD has a macro named MODULE_DEPEND for that, which
> would make sense.
>
> After reading some code, it seems to me that there's no easy way to
> achieve this, as by default there are no symbols that can be found by
> modpost, so something like this is needed:
>
>  const const char *module_b;
>  EXPORT_SYMBOL(module_b);
>
> note: KBUILD_MODNAME can't be used.
>
> And then, use it in module A:
>
>  extern const char *module_b;
>  static const char **test __used = &module_b;
>
> But ultimately, all we want is to add "module_b" to the "depends"
> field in the .modinfo section. It should be relatively easy to achieve
> by having a special section modpost can detect, and then just put it
> into "depends".
>
> Apparently I'm not the first one to have this need[1], but I wonder
> why not more people have it.
> [1] http://article.gmane.org/gmane.linux.kernel/1183905/match=module_depend
>
> --

Eg:

This "bare minimum" module should load "nfs" along with it.
---
#include <linux/module.h>
#include <linux/kernel.h>

int init_module(void)
{
        request_module("nfs");
        return 0;
}

void cleanup_module(void)
{

}

MODULE_LICENSE("GPL");
---
$ sudo insmod test.ko
$ lsmod|grep nfs
nfs                   275462  0
nfs_acl                 2257  1 nfs
lockd                  65605  1 nfs
fscache                46361  1 nfs
auth_rpcgss            34001  1 nfs
sunrpc                193146  5 nfs,nfs_acl,lockd,auth_rpcgss


> Felipe Contreras

Is this what you are looking for or I missed your point ?

HTH,
Maxin B. John
--
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