]> git.karo-electronics.de Git - karo-tx-linux.git/commit
lkdtm: Do not use flush_icache_range() on user addresses
authorCatalin Marinas <catalin.marinas@arm.com>
Tue, 1 Nov 2016 21:43:25 +0000 (14:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2016 14:34:56 +0000 (15:34 +0100)
commitfcd35857d66201b28b3ab158258e88ca7749fcb7
tree4b78cdcb7fb7ea801260ae4b70bba47c918847dd
parent052662cada1f2104dedfab68866e403a508e045c
lkdtm: Do not use flush_icache_range() on user addresses

The flush_icache_range() API is meant to be used on kernel addresses
only as it may not have the infrastructure (exception entries) to handle
user memory faults.

The lkdtm execute_user_location() function tests the kernel execution of
user space addresses by mmap'ing an anonymous page, copying some code
together with cache maintenance and attempting to run it. However, the
cache maintenance step may fail because of the incorrect API usage
described above. The patch changes lkdtm to use access_process_vm() for
copying the code into user space which would take care of the necessary
cache maintenance.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[kees: export access_process_vm() for module use]
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/lkdtm_perms.c
mm/memory.c
mm/nommu.c