Author: blueswirl Date: 2009-01-24 09:23:33 +0100 (Sat, 24 Jan 2009) New Revision: 422
Modified: openbios-devel/config/examples/sparc64_rules.xml openbios-devel/include/libc/string.h openbios-devel/libc/misc.c Log: Add Propolice support
Modified: openbios-devel/config/examples/sparc64_rules.xml =================================================================== --- openbios-devel/config/examples/sparc64_rules.xml 2009-01-24 07:31:45 UTC (rev 421) +++ openbios-devel/config/examples/sparc64_rules.xml 2009-01-24 08:23:33 UTC (rev 422) @@ -38,10 +38,6 @@ INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include AS_FLAGS := -Wa,-xarch=v9b -Wa,-64 -g
-ifeq ($(shell uname), OpenBSD) - CFLAGS+= -fno-stack-protector -endif - # # pre rules #
Modified: openbios-devel/include/libc/string.h =================================================================== --- openbios-devel/include/libc/string.h 2009-01-24 07:31:45 UTC (rev 421) +++ openbios-devel/include/libc/string.h 2009-01-24 08:23:33 UTC (rev 422) @@ -99,4 +99,9 @@
extern int errno_int;
+// Propolice support +extern long __guard[8]; + +void __stack_smash_handler(const char *func, int damaged); + #endif /* _H_STRING */
Modified: openbios-devel/libc/misc.c =================================================================== --- openbios-devel/libc/misc.c 2009-01-24 07:31:45 UTC (rev 421) +++ openbios-devel/libc/misc.c 2009-01-24 08:23:33 UTC (rev 422) @@ -75,3 +75,24 @@
return sum * sign; } + +// Propolice support +long __guard[8] = { +#ifdef CONFIG_BIG_ENDIAN + (0 << 24) | (0 << 16) | ('\n' << 8) | 255, +#else + (255 << 24) | ('\n' << 16) | (0 << 8) | 0, +#endif + 0, 0, 0, 0, 0, 0, 0 +}; + +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 + // XXX: Disable interrupts? + for(;;) + ; +}