• Eric Biggers's avatar
    kmod: make request_module() return an error when autoloading is disabled · 2a87b491
    Eric Biggers authored
    commit d7d27cfc upstream.
    
    Patch series "module autoloading fixes and cleanups", v5.
    
    This series fixes a bug where request_module() was reporting success to
    kernel code when module autoloading had been completely disabled via
    'echo > /proc/sys/kernel/modprobe'.
    
    It also addresses the issues raised on the original thread
    (https://lkml.kernel.org/lkml/20200310223731.126894-1-ebiggers@kernel.org/T/#u)
    bydocumenting the modprobe sysctl, adding a self-test for the empty path
    case, and downgrading a user-reachable WARN_ONCE().
    
    This patch (of 4):
    
    It's long been possible to disable kernel module autoloading completely
    (while still allowing manual module insertion) by setting
    /proc/sys/kernel/modprobe to the empty string.
    
    This can be preferable to setting it to a nonexistent file since it
    avoids the overhead of an attempted execve(), avoids potential
    deadlocks, and avoids the call to security_kernel_module_...
    2a87b491
kmod.c 5.01 KB