summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2009-11-30 00:33:42 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2009-11-30 00:34:36 +0100
commit870925205c78415dc4c594bfae9de8eb31745b81 (patch)
tree522265e51627037194a1d51dbc2344201491cd44 /kern
parent76e00450db45bfc4f2766c67bc861228c1023a75 (diff)
Add stack-protector support
* kern/debug.c (__stack_chk_guard): New variable (__stack_chk_fail): New function.
Diffstat (limited to 'kern')
-rw-r--r--kern/debug.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/kern/debug.c b/kern/debug.c
index 109d920..67b04ad 100644
--- a/kern/debug.c
+++ b/kern/debug.c
@@ -191,3 +191,16 @@ log(int level, const char *fmt, ...)
_doprnt(fmt, &listp, do_cnputc, 0, 0);
va_end(listp);
}
+
+unsigned char __stack_chk_guard [ sizeof (vm_offset_t) ] =
+{
+ [ sizeof (vm_offset_t) - 3 ] = '\r',
+ [ sizeof (vm_offset_t) - 2 ] = '\n',
+ [ sizeof (vm_offset_t) - 1 ] = 0xff,
+};
+
+void
+__stack_chk_fail (void)
+{
+ panic("stack smashing detected");
+}