tails-shell-library should not use rmmod instead of modprobe -r
Originally created by @alant on #10430 (Redmine)
While testing 1.7~rc1, we found that tails-shell-library/hardware.sh
switched from modprobe -r
to rmmod
in the following commit:
commit ed9c96f81a2600cd74fd06e4174f3d994735215f
Author: Tails developers <amnesia@boum.org>
Date: Mon Jan 12 03:01:17 2015 +0100
Use rmmod so we can replace it with /bin/false symlink
So we can make the panic mode module removal fail, for the "MAC
addresse spoofing fails and the module is not removed" scenario.
diff --git a/config/chroot_local-includes/usr/local/lib/tails-shell-library/hardware.sh b/config/chroot_local-includes/usr/local/lib/tails-s
index 66a8079..f56e624 100644
--- a/config/chroot_local-includes/usr/local/lib/tails-shell-library/hardware.sh
+++ b/config/chroot_local-includes/usr/local/lib/tails-shell-library/hardware.sh
@@ -74,5 +74,7 @@ mod_rev_dep() {
# Unloads module $1, and all modules that (transatively) depends on
# $1 (i.e. its reverse dependencies).
unload_module_and_rev_deps() {
- /sbin/modprobe -r $(mod_rev_dep ${1})
+ for mod in $(mod_rev_dep ${1}); do
+ /sbin/rmmod ${mod}
+ done
}
However, using rmmod is not equivalent to modprobe -r. Man modprobe reads “modprobe looks in the module directory /lib/modules/`uname -r` for all the modules and other files, except for the optional configuration files in the /etc/modprobe.d directory (see modprobe.d(5)). modprobe will also use module options specified on the kernel command line in the form of . and blacklists in the form of modprobe.blacklist=”. Basically we loose all the parameters and blacklists we/debian configure. I’m not sure we want that.
We have agreed that “the best would be to switch back to modprobe, and then make our MAC spoofing test inject a modprobe wrapper that acts differently only if the ‘-r’ option is present”
Feature Branch: bugfix/10430-do-not-use-rmmod