lkml.org 
[lkml]   [2013]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/4] lkdtm: fix stack protector trigger
From
Hi,

I'd like to get this series added to lkdtm. Can someone take a moment
to review or ack them?

Thanks,

-Kees

On Sat, Jun 22, 2013 at 11:37 AM, Kees Cook <keescook@chromium.org> wrote:
> 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
>



--
Kees Cook
Chrome OS Security


\
 
 \ /
  Last update: 2013-07-10 23:17    [W:1.350 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site