Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit c1b8f43d authored by Kees Cook's avatar Kees Cook Committed by Prasad Sodagudi
Browse files

UPSTREAM: lkdtm: Avoid more compiler optimizations for bad writes



It seems at least Clang is able to throw away writes it knows are
destined for read-only memory, which makes things like the WRITE_RO test
fail, as the write gets elided. Instead, force the variable to be
volatile, and make similar changes through-out other tests in an effort
to avoid needing to repeat fixing these kinds of problems. Also includes
pr_err() calls in failure paths so that kernel logs are more clear in
the failure case.

Reported-by: default avatarPrasad Sodagudi <psodagud@codeaurora.org>
Suggested-by: default avatarSami Tolvanen <samitolvanen@google.com>
Fixes: 9ae113ce ("lkdtm: add tests for additional page permissions")
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20200625203704.317097-2-keescook@chromium.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
bug: 156889933
(cherry picked from commit 464e86b4abadfc490f426954b431e2ec6a9d7bd2)
[Resolved minor conflicts in drivers/misc/lkdtm/bugs.c for lkdtm_ARRAY_BOUNDS]

Change-Id: I084d34c7fc7685a3b980a8ac5d839d68684cae86
Signed-off-by: default avatarPrasad Sodagudi <psodagud@codeaurora.org>
parent 5d4656c4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment