summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-05-06 23:02:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-05-06 23:02:37 +0000
commit31f45596b15052495adc8fbcd78faa6817305614 (patch)
tree38c13108a5265580c22dbc3c523f9b22b83acf23 /sys/kern
parenta489941c120302c3e2e5d3920d5ffacc0783fd1f (diff)
initialize the propolice cookie more carefully so -fstack-protector-all
will work; ok miod
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/init_main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 573791b6eed..1f7dd45da46 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.129 2006/03/04 22:40:15 brad Exp $ */
+/* $OpenBSD: init_main.c,v 1.130 2006/05/06 23:02:36 deraadt Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -392,7 +392,15 @@ main(void *framep)
#endif
#if !defined(NO_PROPOLICE)
- arc4random_bytes(__guard, sizeof(__guard));
+ {
+ volatile long newguard[8];
+ int i;
+
+ arc4random_bytes((long *)newguard, sizeof(newguard));
+
+ for (i = sizeof(__guard)/sizeof(__guard[0]) - 1; i; i--)
+ __guard[i] = newguard[i];
+ }
#endif
/* init exec and emul */