modprobe broken with recursive deps
Mike Frysinger
vapier at gentoo.org
Tue May 5 12:07:43 UTC 2009
off hand, the last known working version is busybox 1.4.1. i imagine it
worked with later versions, but that is the last one that is readily
accessible under my cross-compile setup that i can confirm. all of 1.13.x+
seem to be broken.
it's a simple config: start with allnoconfig, then just enable insmod, rmmod,
lsmod, and modprobe (linux-2.6 only).
then with a simple dependency list:
.../snd-page-alloc.ko:
.../snd.ko: .../soundcore.ko
.../snd-timer.ko: .../snd.ko
.../soundcore.ko:
.../snd-pcm.ko: .../snd-timer.ko .../snd-page-alloc.ko .../snd.ko
doing `modprobe` on any module that only has a dependency list <=1 level deep
works fine. as soon as i try to modprobe anything deeper, modprobe fails to
act recursively. so lets look at the case of `modprobe snd-pcm` ...
reading (and testing) the code shows:
- modprobe_main() adds only specified modules ("snd-pcm" here) to the global
modentry db
- load_modules_dep() only loads dependencies only for modules already in the
modentry db
- snd-pcm's dependencies get recorded properly (snd-timer/snd-page-alloc/snd)
- no other module or its dependencies are known (so the fact that snd
requires soundcore is lost/ignored)
- modprobe_main() walks the requested module list and calls do_modprobe() on
each one in it (only "snd-pcm" here)
- do_modprobe() attempts to load only modules specified in the modules direct
dependencies (snd-timer/snd-page-alloc/snd)
- init_module() fails on "snd" due to unknown symbols because "soundcore" was
never requested let alone loaded
seems a lot of the cleanup work that was added stuck to the list concept at
the expense of unlimited recursion depth ...
i'm not familiar enough to commit a fix here, but what i had to do to make it
work is:
- have load_modules_dep() load all dependency info
- have do_modprobe() recursively call do_modprobe() on each dependency
@@ -222,2 +227,3 @@ static int do_modprobe(struct module_entry *m)
m2 = get_or_add_modentry(fn);
+ rc = do_modprobe(m2);
if (option_mask32 & MODPROBE_OPT_REMOVE) {
@@ -268,5 +274,3 @@ static void load_modules_dep(void)
- while (G.num_unresolved_deps
- && config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)
- ) {
+ while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) {
colon = last_char_is(tokens[0], ':');
@@ -276,3 +280,3 @@ static void load_modules_dep(void)
- m = get_modentry(tokens[0]);
+ m = get_or_add_modentry(tokens[0]);
if (m == NULL)
@@ -289,4 +295,5 @@ static void load_modules_dep(void)
m->flags |= MODULE_FLAG_FOUND_IN_MODDEP;
- if ((m->flags & MODULE_FLAG_NEED_DEPS) && (m->deps == NULL)) {
- G.num_unresolved_deps--;
+ if ((m->deps == NULL)) {
+ if (m->flags & MODULE_FLAG_NEED_DEPS)
+ G.num_unresolved_deps--;
llist_add_to(&m->deps, xstrdup(tokens[0]));
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090505/3f080568/attachment.pgp>
More information about the busybox
mailing list