diff options
author | 2013-05-30 18:20:17 +0000 | |
---|---|---|
committer | 2013-05-30 18:20:17 +0000 | |
commit | c51da75f8cf387c615a891a7d8a75b813604fdd7 (patch) | |
tree | 8df9c2531a8cd2596453ce0aaf85c7f74661be1d | |
parent | in the brave new world of void *, we don't need caddr_t casts (diff) | |
download | wireguard-openbsd-c51da75f8cf387c615a891a7d8a75b813604fdd7.tar.xz wireguard-openbsd-c51da75f8cf387c615a891a7d8a75b813604fdd7.zip |
tiny change to support two poison values based on page addr
-rw-r--r-- | sys/kern/subr_poison.c | 18 |
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 |