linux/drivers/misc/lkdtm
Christophe Leroy 72a8643304 lkdtm: Fix execute_[user]_location()
execute_location() and execute_user_location() intent
to copy do_nothing() text and execute it at a new location.
However, at the time being it doesn't copy do_nothing() function
but do_nothing() function descriptor which still points to the
original text. So at the end it still executes do_nothing() at
its original location allthough using a copied function descriptor.

So, fix that by really copying do_nothing() text and build a new
function descriptor by copying do_nothing() function descriptor and
updating the target address with the new location.

Also fix the displayed addresses by dereferencing do_nothing()
function descriptor.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/4055839683d8d643cd99be121f4767c7c611b970.1644928018.git.christophe.leroy@csgroup.eu
2022-02-16 23:25:12 +11:00
..
bugs.c lkdtm: avoid printk() in recursive_loop() 2021-12-16 15:54:37 -08:00
cfi.c lkdtm: Add CONFIG hints in errors where possible 2021-06-24 15:32:08 +02:00
core.c Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
fortify.c lkdtm/fortify: Consolidate FORTIFY_SOURCE tests 2021-08-18 22:28:51 +02:00
heap.c lkdtm/heap: Avoid __alloc_size hint warning for VMALLOC_LINEAR_OVERFLOW 2021-08-18 22:28:51 +02:00
lkdtm.h lkdtm/bugs: Check that a per-task stack canary exists 2021-10-25 09:13:46 +02:00
Makefile Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
perms.c lkdtm: Fix execute_[user]_location() 2022-02-16 23:25:12 +11:00
powerpc.c lkdtm/powerpc: Add SLB multihit test 2020-12-04 01:01:34 +11:00
refcount.c lkdtm: Remove references to CONFIG_REFCOUNT_FULL 2019-11-25 09:15:46 +01:00
rodata.c lkdtm: don't move ctors to .rodata 2020-12-09 15:51:14 +01:00
stackleak.c lkdtm: Add CONFIG hints in errors where possible 2021-06-24 15:32:08 +02:00
usercopy.c lkdtm: Add CONFIG hints in errors where possible 2021-06-24 15:32:08 +02:00