summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-09-27 12:23:41 +0000
committertedu <tedu@openbsd.org>2014-09-27 12:23:41 +0000
commitded71d75433e1e529c5a7040602ac5a73e90562b (patch)
treee438c6494259bfac0de919298d6e68c5eb13b86d /sys
parentAlso in debug mode, close nullfd when it is not needed anymore. (diff)
downloadwireguard-openbsd-ded71d75433e1e529c5a7040602ac5a73e90562b.tar.xz
wireguard-openbsd-ded71d75433e1e529c5a7040602ac5a73e90562b.zip
add back inverted poison patterns. keep high bits, but twiddle low bits.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_poison.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/kern/subr_poison.c b/sys/kern/subr_poison.c
index 126462ba94f..95a4f87b77a 100644
--- a/sys/kern/subr_poison.c
+++ b/sys/kern/subr_poison.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_poison.c,v 1.11 2014/07/22 21:41:09 deraadt Exp $ */
+/* $OpenBSD: subr_poison.c,v 1.12 2014/09/27 12:23:41 tedu Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
@@ -44,7 +44,17 @@ poison_value(void *v)
l = l >> PAGE_SHIFT;
- return (l & 1) ? POISON0 : POISON1;
+ switch (l & 3) {
+ case 0:
+ return POISON0;
+ case 1:
+ return POISON1;
+ case 2:
+ return (POISON0 & 0xffff0000) | (~POISON0 & 0x0000ffff);
+ case 3:
+ return (POISON1 & 0xffff0000) | (~POISON1 & 0x0000ffff);
+ }
+ return 0;
}
void