]> git.baikalelectronics.ru Git - kernel.git/commit
module: Add more error message for failed kernel module loading
authorQu Wenruo <wqu@suse.com>
Wed, 2 Sep 2020 06:46:19 +0000 (14:46 +0800)
committerJessica Yu <jeyu@kernel.org>
Wed, 2 Sep 2020 09:18:40 +0000 (11:18 +0200)
commit73b43e98d34dc0782231fbb2d816fd5497c7b0db
tree5a2b321561dac98978a4439f0224bb1606f0bb9f
parentbeea5f8bd9170d3d0e6476d33bde88d795ce40b0
module: Add more error message for failed kernel module loading

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: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
kernel/module.c