• Qu Wenruo's avatar
    module: Add more error message for failed kernel module loading · 14721add
    Qu Wenruo authored
    When kernel module loading failed, user space only get one of the
    following error messages:
    
    - ENOEXEC
      This is the most confusing one. From corrupted ELF header to bad
      WRITE|EXEC flags check introduced by in module_enforce_rwx_sections()
      all returns this error number.
    
    - EPERM
      This is for blacklisted modules. But mod doesn't do extra explain
      on this error either.
    
    - ENOMEM
      The only error which needs no explain.
    
    This means, if a user got "Exec format error" from modprobe, it provides
    no meaningful way for the user to debug, and will take extra time
    communicating to get extra info.
    
    So this patch will add extra error messages for -ENOEXEC and -EPERM
    errors, allowing user to do better debugging and reporting.
    Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
    14721add
module.c 117 KB