diff -r 20522afb2615 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Wed Oct 18 19:23:32 2006 +0100 +++ b/xen/arch/x86/setup.c Wed Oct 18 09:03:33 2006 +0200 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -668,6 +669,8 @@ void __init __start_xen(multiboot_info_t cmdline) != 0) panic("Could not set up DOM0 guest OS\n"); + init_guard(); + /* Scrub RAM that is still free and so may go to an unprivileged domain. */ scrub_heap_pages(); diff -r 20522afb2615 xen/common/Makefile --- a/xen/common/Makefile Wed Oct 18 19:23:32 2006 +0100 +++ b/xen/common/Makefile Wed Oct 18 09:03:33 2006 +0200 @@ -5,6 +5,7 @@ obj-y += elf.o obj-y += elf.o obj-y += event_channel.o obj-y += grant_table.o +obj-y += guard.o obj-y += kernel.o obj-y += keyhandler.o obj-y += lib.o diff -r 20522afb2615 xen/common/guard.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/common/guard.c Wed Oct 18 09:03:33 2006 +0200 @@ -0,0 +1,34 @@ + +#include + +long __guard[8]; + +void __stack_smash_handler(char [], int __attribute__((unused))); + +void +__stack_smash_handler(char func[], int damaged) +{ + panic("smashed stack in %s", func); +} + + +void init_guard(void) +{ + volatile long newguard[8]; + int i; + + /* XXX newguard is intended to get filled with random values. + * But there's nothing to use, so this is just something + * out of my head :) */ + newguard[0] = 103958; + newguard[1] = 3505; + newguard[2] = 75601; + newguard[3] = 35703; + newguard[4] = 94; + newguard[5] = 721; + newguard[6] = 3094; + newguard[7] = 217; + + for (i = sizeof(__guard) / sizeof(__guard[0]) - 1; i; i--) + __guard[i] = newguard[i]; +} diff -r 20522afb2615 xen/include/xen/guard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/xen/guard.h Wed Oct 18 09:03:33 2006 +0200 @@ -0,0 +1,3 @@ + + +void init_guard(void);