aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/busybox/1.33.0/busybox-1.20.2-modprobe.patch')
-rw-r--r--patches/busybox/1.33.0/busybox-1.20.2-modprobe.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/patches/busybox/1.33.0/busybox-1.20.2-modprobe.patch b/patches/busybox/1.33.0/busybox-1.20.2-modprobe.patch
new file mode 100644
index 0000000..9021a0f
--- /dev/null
+++ b/patches/busybox/1.33.0/busybox-1.20.2-modprobe.patch
@@ -0,0 +1,46 @@
+Load modules by absolute path in busybox modprobe
+
+Our switch to busybox modprobe broke ZFS module loading where busybox
+modprobe would load two modules and then fail. Limited developer time
+resulted in a hack being put into place to repeat modprobe until ZFS
+appeared. However, this was never a real long term solution.
+
+Recent analysis with strace suggests that loading two modules corrupts
+busybox's current working directory inside the kernel. Consequently,
+subsequent tests where absolute paths were used instead of relative ones
+made the problem disappear.
+
+Modifying busybox to use full paths when loading modules makes module
+loading work on all affected kernels. While the long term plan is to fix
+the kernel, this workaround will be needed indefinitely for affected
+kernels, even after mainline Linux is fixed.
+
+Signed-off-by: Richard Yao <ryao@gentoo.org>
+
+Added via commit 006a5d6d56e622b5ef82e5a066ca7af7b8c2aeed.
+
+--- a/modutils/modprobe.c
++++ b/modutils/modprobe.c
+@@ -413,7 +413,7 @@ static int do_modprobe(struct module_entry *m)
+ rc = 0;
+ while (m->deps) {
+ struct module_entry *m2;
+- char *fn, *options;
++ char *fn, *options, *path;
+
+ rc = 0;
+ fn = llist_pop(&m->deps); /* we leak it */
+@@ -460,7 +460,11 @@ static int do_modprobe(struct module_entry *m)
+ continue;
+ }
+
+- rc = bb_init_module(fn, options);
++ path = xmalloc(strlen(fn) + strlen(CONFIG_DEFAULT_MODULES_DIR) + strlen(G.uts.release) + 3);
++ sprintf(path, "%s/%s/%s", CONFIG_DEFAULT_MODULES_DIR, G.uts.release, fn);
++
++ rc = bb_init_module(path, options);
++ free(path);
+ DBG("loaded %s '%s', rc:%d", fn, options, rc);
+ if (rc == EEXIST)
+ rc = 0;
+