Author: blueswirl Date: 2009-05-20 20:07:09 +0200 (Wed, 20 May 2009) New Revision: 490
Modified: trunk/openbios-devel/include/libc/string.h trunk/openbios-devel/libc/misc.c Log: Fix stack protector problems with newer GCC versions
Modified: trunk/openbios-devel/include/libc/string.h =================================================================== --- trunk/openbios-devel/include/libc/string.h 2009-05-17 18:59:32 UTC (rev 489) +++ trunk/openbios-devel/include/libc/string.h 2009-05-20 18:07:09 UTC (rev 490) @@ -103,5 +103,6 @@ extern long __guard[8];
void __stack_smash_handler(const char *func, int damaged); +void __stack_chk_fail(void);
#endif /* _H_STRING */
Modified: trunk/openbios-devel/libc/misc.c =================================================================== --- trunk/openbios-devel/libc/misc.c 2009-05-17 18:59:32 UTC (rev 489) +++ trunk/openbios-devel/libc/misc.c 2009-05-20 18:07:09 UTC (rev 490) @@ -86,13 +86,24 @@ 0, 0, 0, 0, 0, 0, 0 };
-void __stack_smash_handler(const char *func, int damaged) +static void freeze(void) { - printk("Propolice detected a stack smashing attack %x at function %s," - " freezing\n", damaged, func); - // Freeze // XXX: Disable interrupts? for(;;) ; } + +void __stack_smash_handler(const char *func, int damaged) +{ + printk("Propolice detected a stack smashing attack %x at function %s," + " freezing\n", damaged, func); + freeze(); +} + +void __stack_chk_fail(void) +{ + printk("Propolice detected a stack smashing attack, freezing\n"); + + freeze(); +}