lkml.org 
[lkml]   [2017]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] lkdtm: hide stack overflow warning for corrupt-stack test
On Mon, Jan 16, 2017 at 2:23 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
>
>> After the latest change to make sure the compiler actually does a memset,
>> it is now smart enough to flag the stack overflow at compile time,
>> at least with gcc-7.0:
>>
>> drivers/misc/lkdtm_bugs.c: In function 'lkdtm_CORRUPT_STACK':
>> drivers/misc/lkdtm_bugs.c:88:144: warning: 'memset' writing 64 bytes into a region of size 8 overflows the destination [-Wstringop-overflow=]
>>
>> To outsmart the compiler again, this moves the memset into a noinline
>> function where (for now) it doesn't see that we intentionally write
>> broken code here.
>
> Heh, darn it.
>
> I suspect this is an arms race we are eventually going to lose. At some
> point we might have to switch to writing some of these in asm :/

Yeah, though I'm going to keep trying to avoid this as much as
possible. I was almost there when building the .rodata execution test,
but I found horrible tricks. :P

-Kees

--
Kees Cook
Nexus Security

\
 
 \ /
  Last update: 2017-01-16 23:08    [W:0.290 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site