diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2024-02-16 09:14:27 +0100 |
---|---|---|
committer | Luis Chamberlain <mcgrof@kernel.org> | 2024-02-16 11:30:43 -0800 |
commit | d1909c0221739356f31c721de4743e7d219a56cc (patch) | |
tree | 17fef68d60f0e59ab3697324b5f361caf255b4d6 /init | |
parent | 157285397f6a7b35d8f7f115e1be24f49e947ba3 (diff) |
module: Don't ignore errors from set_memory_XX()
set_memory_ro(), set_memory_nx(), set_memory_x() and other helpers
can fail and return an error. In that case the memory might not be
protected as expected and the module loading has to be aborted to
avoid security issues.
Check return value of all calls to set_memory_XX() and handle
error if any.
Add a check to not call set_memory_XX() on NULL pointers as some
architectures may not like it allthough numpages is always 0 in that
case. This also avoid a useless call to set_vm_flush_reset_perms().
Link: https://github.com/KSPP/linux/issues/7
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions