[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stack protection via GCC's `-fstack-protector'
From: |
Thomas Schwinge |
Subject: |
Re: Stack protection via GCC's `-fstack-protector' |
Date: |
Wed, 8 Nov 2006 23:36:20 +0100 |
User-agent: |
Mutt/1.5.6+20040907i |
Hello!
On Wed, Nov 08, 2006 at 11:14:19PM +0100, Samuel Thibault wrote:
> Thomas Schwinge, le Wed 08 Nov 2006 22:40:54 +0100, a ?crit :
> > Is it feasible to have the `-fstack-protector' functionality in GNU Mach
> > and GRUB2 (and how to do that, then) or shall we unconditionally pass
> > `-fno-stack-protector' if available?
>
> I'd say it shouldn't be very hard to provide a stack_chk_fail function,
> even if all it does is just panic().
Having had a look at glibc's implementation and its complexity ;-) that
might indeed be a reachable goal (assuming that no other surprises show
up):
debug/stack_chk_fail.c
#v+
[Copyright header.]
#include <stdio.h>
#include <stdlib.h>
extern char **__libc_argv attribute_hidden;
void
__attribute__ ((noreturn))
__stack_chk_fail (void)
{
/* The loop is added only to keep gcc happy. */
while (1)
__libc_message (1, "*** stack smashing detected ***: %s terminated\n",
__libc_argv[0] ?: "<unknown>");
}
#v-
I'll give it a try.
Regards,
Thomas
signature.asc
Description: Digital signature