Commit 629c66a2 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman

lkdtm: isolate stack corruption test

When tests were added to lkdtm that grew the stack frame, the stack
corruption test stopped working. This isolates the test in its own
function, and forces it not to be inlined.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Fixes: cc33c537 ("lkdtm: add "EXEC_*" triggers")
Cc: stable <stable@vger.kernel.org> # 3.12
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eec86b8e
......@@ -297,6 +297,14 @@ static void do_nothing(void)
return;
}
static noinline void corrupt_stack(void)
{
/* Use default char array length that triggers stack protection. */
char data[8];
memset((void *)data, 0, 64);
}
static void execute_location(void *dst)
{
void (*func)(void) = dst;
......@@ -327,13 +335,9 @@ static void lkdtm_do_action(enum ctype which)
case CT_OVERFLOW:
(void) recursive_loop(0);
break;
case CT_CORRUPT_STACK: {
/* Make sure the compiler creates and uses an 8 char array. */
volatile char data[8];
memset((void *)data, 0, 64);
case CT_CORRUPT_STACK:
corrupt_stack();
break;
}
case CT_UNALIGNED_LOAD_STORE_WRITE: {
static u8 data[5] __attribute__((aligned(4))) = {1, 2,
3, 4, 5};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment