busybox modprobe v modules.builtin

Denys Vlasenko vda.linux at googlemail.com
Tue Jun 29 22:49:12 UTC 2021


Thanks for the report.
Fixing like so:

--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -629,8 +629,9 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
                config_close(parser);

                parser = config_open2("modules.builtin", fopen_for_read);
+               /* this file contains lines like "kernel/fs/binfmt_script.ko" */
                while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL))
-                       get_or_add_modentry(s)->flags |= MODULE_FLAG_BUILTIN;
+                       get_or_add_modentry(bb_basename(s))->flags |=
MODULE_FLAG_BUILTIN;
                config_close(parser);
        }

On Mon, Jun 28, 2021 at 11:04 AM Rasmus Villemoes
<rasmus.villemoes at prevas.dk> wrote:
>
> When I do
>
>   busybox modprobe squashfs
>
> with squashfs builtin to the kernel, I get
>
>   modprobe: module squashfs not found in modules.dep
>
> and an exit value of 1. But
>
> commit 803c85a20710b8d9026775f5668237fff496dc1e
> Author: Ben Hutchings <ben at decadent.org.uk>
> Date:   Thu Apr 6 11:54:04 2017 +0200
>
>     modprobe: read modules.builtin
>
> suggests that this should work as expected (silent success), as for kmod
> modprobe. I'm pretty sure the problem is the (older!)
>
> commit 78854520ebecfd24d5c80a266d6779bd1e069016
> Author: Denys Vlasenko <vda.linux at googlemail.com>
> Date:   Thu Jan 1 19:02:40 2015 +0100
>
>     modprobe: revert checking for /, stop doing basename() on modprobe args
>
> because when reading in modules.builtin, we very much need to do that
> basenamization. And a very quick test switching back to
> bb_get_last_path_component_nostrip() in filename2modname() makes
> modprobe work as expected for the above case.
>
> I see that there are several commits already dealing with 788545, e.g.
>
> commit a88db5c1a99ebc0ae23b5d108113d9b8af7afc3c
> Author: Denys Vlasenko <vda.linux at googlemail.com>
> Date:   Sat Feb 21 17:08:35 2015 +0100
>
>     modinfo: fix fallout from basename removal
>
> commit 9de69c024c7c47f3f8733dbc7c9522966fcd73a9
> Author: Natanael Copa <ncopa at alpinelinux.org>
> Date:   Fri Jan 16 13:53:05 2015 +0100
>
>     modprobe: fix modprobe -r and parsing of /etc/modprobe.d
>
> commit e998b08f118a0e485fffaa513bac133df2e3843b
> Author: Denys Vlasenko <vda.linux at googlemail.com>
> Date:   Thu Jan 15 02:48:36 2015 +0100
>
>     modprobe: fix recent breakage: modules.dep reading code needs to
> strip dirname
>
> I have no idea what the right fix is. There seems to be a big confusion
> about when a string is a pathname, filename, module name or module alias.
>
> Rasmus


More information about the busybox mailing list