diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-13 06:11:12 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-13 06:11:12 +0000 |
commit | 22a330f3fea3925c8b1a1cc59340c512e70867c0 (patch) | |
tree | 7cea4db8c5db09b19857bd961213e957db963b79 /sys/kern | |
parent | 1cdbc3d18683a389c54ce61ec105d75fe6ffa5ef (diff) |
support for propolice in the kernel.
some style input itojun@ tdeval@ toby@
tested, mostly by deraadt, on i386, macppc, vax, sparc64
ok deraadt@ miod@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/init_main.c | 10 | ||||
-rw-r--r-- | sys/kern/kern_xxx.c | 11 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index ab8b820d19a..6124b421e33 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.102 2003/05/09 00:49:46 art Exp $ */ +/* $OpenBSD: init_main.c,v 1.103 2003/05/13 06:11:11 tedu Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -80,6 +80,8 @@ #include <sys/syscall.h> #include <sys/syscallargs.h> +#include <dev/rndvar.h> + #include <ufs/ufs/quota.h> #include <machine/cpu.h> @@ -125,6 +127,8 @@ int boothowto; struct timeval boottime; struct timeval runtime; +long __guard[8]; + /* XXX return int so gcc -Werror won't complain */ int main(void *); void check_console(struct proc *); @@ -176,6 +180,7 @@ main(framep) quad_t lim; int s, i; register_t rval[2]; + int *guard = (int *)&__guard[0]; extern struct pdevinit pdevinit[]; extern void scheduler_start(void); extern void disk_init(void); @@ -363,6 +368,9 @@ main(framep) kmstartup(); #endif + for (i = 0; i < sizeof(__guard) / 4; i++) + guard[i] = arc4random(); + /* Start the scheduler */ scheduler_start(); diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 86916a64e2f..0988b29c726 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_xxx.c,v 1.5 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: kern_xxx.c,v 1.6 2003/05/13 06:11:11 tedu Exp $ */ /* $NetBSD: kern_xxx.c,v 1.32 1996/04/22 01:38:41 christos Exp $ */ /* @@ -64,6 +64,15 @@ sys_reboot(p, v, retval) return (0); } +void __stack_smash_handler(char [], int __attribute__((unused))); + +void +__stack_smash_handler(char func[], int damaged) +{ + panic("smashed stack in %s", func); +} + + #ifdef SYSCALL_DEBUG #define SCDEBUG_CALLS 0x0001 /* show calls */ #define SCDEBUG_RETURNS 0x0002 /* show returns */ |