mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] lkdtm: various improvements
@ 2013-06-22 18:37 Kees Cook
  2013-06-22 18:37 ` [PATCH 1/4] lkdtm: fix stack protector trigger Kees Cook
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Kees Cook @ 2013-06-22 18:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Arnd Bergmann, Ankita Garg, Simon Kagstrom

This series adds several new test targets that have been useful when
testing various kernel crash conditions while working on Chrome OS,
and corrects the CORRUPT_STACK trigger as well.

Thanks,

-Kees


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 1/4] lkdtm: fix stack protector trigger
@ 2013-07-08 17:01 Kees Cook
  0 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2013-07-08 17:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Arnd Bergmann, Ankita Garg, Simon Kagstrom,
	Kees Cook

The -fstack-protector compiler flag will only build stack protections if
a character array is seen. Additionally, the offset to the saved
instruction pointer changes based on architecture, so stomp much harder
(64 bytes) when corrupting the stack.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/misc/lkdtm.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index 08aad69..adb6bde 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -295,10 +295,10 @@ static void lkdtm_do_action(enum ctype which)
 		(void) recursive_loop(0);
 		break;
 	case CT_CORRUPT_STACK: {
-		volatile u32 data[8];
-		volatile u32 *p = data;
+		/* Make sure the compiler creates and uses an 8 char array. */
+		volatile char data[8];
 
-		p[12] = 0x12345678;
+		memset((void *)data, 0, 64);
 		break;
 	}
 	case CT_UNALIGNED_LOAD_STORE_WRITE: {
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-07-08 17:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-22 18:37 [PATCH 0/4] lkdtm: various improvements Kees Cook
2013-06-22 18:37 ` [PATCH 1/4] lkdtm: fix stack protector trigger Kees Cook
2013-07-08 13:09   ` Kees Cook
2013-07-08 16:42     ` Greg Kroah-Hartman
2013-07-08 16:59       ` Kees Cook
2013-06-22 18:37 ` [PATCH 2/4] lkdtm: add "WARNING" trigger Kees Cook
2013-06-22 18:37 ` [PATCH 3/4] lkdtm: add "SPINLOCKUP" trigger Kees Cook
2013-06-22 18:37 ` [PATCH 4/4] lkdtm: add "EXEC_*" triggers Kees Cook
2013-07-08 17:01 [PATCH 1/4] lkdtm: fix stack protector trigger Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®