Re: git: e1e847374bcc - main - Add DEBUG_POISON_POINTER
Date: Tue, 28 Nov 2023 17:21:36 UTC
Mateusz, On Tue, Nov 28, 2023 at 04:35:40PM +0000, Mateusz Guzik wrote: M> Add DEBUG_POISON_POINTER M> M> If you have a pointer which you know points to stale data, you can M> fill it with junk so that dereference later will trap M> M> Reviewed by: kib M> Sponsored by: Rubicon Communications, LLC ("Netgate") M> Differential Revision: https://reviews.freebsd.org/D40946 M> --- M> sys/kern/vfs_bio.c | 6 ++++++ M> sys/sys/kassert.h | 31 +++++++++++++++++++++++++++++++ M> 2 files changed, 37 insertions(+) M> M> diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c M> index 31059f1c0a94..4e0832475c3e 100644 M> --- a/sys/kern/vfs_bio.c M> +++ b/sys/kern/vfs_bio.c M> @@ -159,6 +159,9 @@ nbufp(unsigned i) M> } M> M> caddr_t __read_mostly unmapped_buf; M> +#ifdef INVARIANTS M> +caddr_t poisoned_buf = (void *)-1; M> +#endif Is there any good reason to use caddr_t here instead of void *? Later it is casted back to normal void* in #define DEBUG_POISON_POINTER(x). -- Gleb Smirnoff