On some systems like Chromium OS, loading modules from non-verified
filesystems is denied. Only finit_module is allowed because an open
fd is passed which can be checked against a verified location.
Change the module loading code to first attempt finit_module and if
that fails for whatever reason, fall back to the existing logic.
On x86_64, this adds ~80 bytes to modutils/modutils.o and ~68 bytes
to modutils/modprobe-small.o.
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
"modprobe minix; echo $?"
Was:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
modprobe: 'kernel/fs/minix/minix.ko.xz': Success
0
Now:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This matches behavior with kmod which has been the standard for a long
time at this point.
URL: https://bugs.busybox.net/8021
Reported-by: Jö <jorrit@jorrit.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
usecase:
two sd cards are being mounted in parallel at same time on dual core. example
modules which are getting loaded is nls_cp437. While one module is being
loaded , it makes state in /proc/modules as 'coming' and then starts doing its
module init function (in our case - registering nls). meanwhile on other core,
if modprobe returns that is has already been loaded, then it will continue
and search for the nls list which is not yet finished from first module init.
This fails resulting in not mounting sd card.
function old new delta
process_module 667 746 +79
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
"rmmod OUT_OF_TREE_MODULE" was not working, because module is not in depmod file.
In general, rmmod doesn't need scanning, it simply unloads every argv[i].
function old new delta
rmmod - 63 +63
modprobe_main 449 465 +16
process_module 705 667 -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 79/-38) Total: 41 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This fixes a regression introduced with commit 78854520 (modprobe:
revert checking for /, stop doing basename() on modprobe args,
2015-01-01) that broke modprobe options stored in /etc/modprobe.conf and
/etc/modprobe.d/*.conf.
This also fixes modprobe -r
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
"modprobe -r MODNAME", after it found the full module pathname,
should strip dirpath before trying to remove the module.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
display() function returns the length of the value we are displaying + 1.
As a consequence, if we have field=value\0field=value\0field=value in the
binary, then the second occurence will be skipped as ptr will miss the first
character of the following field.
Example trying to list aliases from ixgbe.ko on a 3.2 kernel.
- In the module we have:
alias=pci:v00008086d00001560sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Asv*sd*bc*sc*i*\0
alias=pci:v00008086d00001557sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Fsv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Dsv*sd*bc*sc*i*\0
...
- Using modinfo -F alias ixgbe returns:
alias: pci:v00008086d00001560sv*sd*bc*sc*i*
alias: pci:v00008086d00001557sv*sd*bc*sc*i*
alias: pci:v00008086d0000154Dsv*sd*bc*sc*i*
...
This problem appeared with kernel commit "modules: no need to align .modinfo
strings" b6472776816af1ed52848c93d26e3edb3b17adab in 2.6.37.
Fix this by not trusting display() return value but increment ptr by strlen(ptr)
(the same way as depmod.c does).
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Closes 627 and 7034.
Commonly seen case is (un)loading of an alias
which matches ata_generic and a more specific ata module.
For example:
modprobe [-r] pci:v00008086d00007010sv00000000sd00000000bc01sc01i80
(ata_generic and pata_acpi)
modprobe [-r] pci:v00001106d00000571sv00001509sd00009022bc01sc01i8a
(ata_generic and pata_via)
function old new delta
process_module 615 728 +113
parse_module 309 395 +86
find_alias 621 653 +32
pathname_matches_modname 78 79 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 232/0) Total: 232 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>