Submitted By: Robert Connolly (ashes) Date: 2004-08-30 Initial Package Version: 2.4.27 Upstream Status: Rejected Upstream Origin: http://www.northernsecurity.net/adamantix/diffs/2.4.20-propolice.patch Description: Linux kernel patch for Smashing Stack Protector. This patch allows the use of -fstack-protector durring the kernel build. http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt http://www.linuxfromscratch.org/hlfs/ diff -Naur linux-2.4.26.orig/include/linux/kernel.h linux-2.4.26.ssp/include/linux/kernel.h --- linux-2.4.26.orig/include/linux/kernel.h 2002-11-28 23:53:15.000000000 +0000 +++ linux-2.4.26.ssp/include/linux/kernel.h 2004-04-18 19:54:08.000000000 +0000 @@ -86,6 +86,9 @@ extern void dev_probe_lock(void); extern void dev_probe_unlock(void); +extern int __guard; +extern void __stack_smash_handler(int, char []); + extern int session_of_pgrp(int pgrp); asmlinkage int printk(const char * fmt, ...) diff -Naur linux-2.4.26.orig/kernel/ksyms.c linux-2.4.26.ssp/kernel/ksyms.c --- linux-2.4.26.orig/kernel/ksyms.c 2004-02-18 13:36:32.000000000 +0000 +++ linux-2.4.26.ssp/kernel/ksyms.c 2004-04-18 19:54:08.000000000 +0000 @@ -528,6 +528,8 @@ EXPORT_SYMBOL(single_open); EXPORT_SYMBOL(single_release); EXPORT_SYMBOL(seq_release_private); +EXPORT_SYMBOL_NOVERS(__guard); +EXPORT_SYMBOL_NOVERS(__stack_smash_handler); /* Program loader interfaces */ EXPORT_SYMBOL(setup_arg_pages); diff -Naur linux-2.4.26.orig/lib/Makefile linux-2.4.26.ssp/lib/Makefile --- linux-2.4.26.orig/lib/Makefile 2004-04-14 13:05:40.000000000 +0000 +++ linux-2.4.26.ssp/lib/Makefile 2004-04-18 19:54:08.000000000 +0000 @@ -12,7 +12,7 @@ rbtree.o crc32.o firmware_class.o obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o \ - bust_spinlocks.o rbtree.o dump_stack.o + bust_spinlocks.o rbtree.o dump_stack.o propolice.o obj-$(CONFIG_FW_LOADER) += firmware_class.o obj-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o diff -Naur linux-2.4.26.orig/lib/propolice.c linux-2.4.26.ssp/lib/propolice.c --- linux-2.4.26.orig/lib/propolice.c 1970-01-01 00:00:00.000000000 +0000 +++ linux-2.4.26.ssp/lib/propolice.c 2004-04-18 19:54:08.000000000 +0000 @@ -0,0 +1,13 @@ + /* + * linux/lib/errno.c + * + * + */ + + int __guard = '\0\0\n\777'; + + void __stack_smash_handler (int damaged, char func[]) + { + static char *message = "propolice detects %x at function %s.\n" ; + panic (message, damaged, func); +}