]> xenbits.xensource.com Git - xen.git/commitdiff
minios: _chk_fail and _chk canaries for minios and newlib
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 31 Mar 2009 10:36:11 +0000 (11:36 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 31 Mar 2009 10:36:11 +0000 (11:36 +0100)
Add __stack_chk_fail to mini-os and __sprintf_chk __fprintf_chk to
newlib, to cope with ocaml runtimes compiled with -fstack-protector.

From: "George S. Coker, II" <gscoker@alpha.ncsc.mil>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
extras/mini-os/lib/stack_chk_fail.c [new file with mode: 0644]
stubdom/Makefile

diff --git a/extras/mini-os/lib/stack_chk_fail.c b/extras/mini-os/lib/stack_chk_fail.c
new file mode 100644 (file)
index 0000000..ade0045
--- /dev/null
@@ -0,0 +1,8 @@
+#include <kernel.h>
+#include <console.h>
+
+void __stack_chk_fail(void)
+{
+    printk("stack smashing detected\n");
+    do_exit();
+}
index dcb614fc85cd5f9a39d81c4ea3a886266b67c1b5..fabb6908decc6674928bf3f2e3bdb19919c71924 100644 (file)
@@ -91,6 +91,7 @@ newlib-$(NEWLIB_VERSION).tar.gz:
 newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
        tar xzf $<
        patch -d $@ -p0 < newlib.patch
+       patch -d $@ -p0 < newlib-chk.patch
        touch $@
 
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a