summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-05-30 18:20:18 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-05-30 18:20:18 +0000
commitbe7069b9bee04028c92f19af3c7d94bfc9126765 (patch)
tree55fba219c5efb2a2aedfabe5a56d0aa83723d4a4
parente326c018136b1e47060c57c7f4f2cf3056a19f9b (diff)
tiny change to support two poison values based on page addr
-rw-r--r--sys/kern/subr_poison.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/kern/subr_poison.c b/sys/kern/subr_poison.c
index 93e04a7b30f..73678f65c3e 100644
--- a/sys/kern/subr_poison.c
+++ b/sys/kern/subr_poison.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_poison.c,v 1.3 2013/05/02 18:55:24 tedu Exp $ */
+/* $OpenBSD: subr_poison.c,v 1.4 2013/05/30 18:20:17 tedu Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
@@ -16,6 +16,7 @@
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/malloc.h>
/*
@@ -23,16 +24,25 @@
* that modifications after frees can be detected.
*/
#ifdef DEADBEEF0
-#define POISON ((unsigned) DEADBEEF0)
+#define POISON0 ((unsigned) DEADBEEF0)
#else
-#define POISON ((unsigned) 0xdeadbeef)
+#define POISON0 ((unsigned) 0xdeadbeef)
+#endif
+#ifdef DEADBEEF1
+#define POISON1 ((unsigned) DEADBEEF1)
+#else
+#define POISON1 ((unsigned) 0xdeafbead)
#endif
#define POISON_SIZE 64
int32_t
poison_value(void *v)
{
- return POISON;
+ ulong l = (u_long)v;
+
+ l = l >> PAGE_SHIFT;
+
+ return (l & 1) ? POISON0 : POISON1;
}
void