Date: Tue, 28 Nov 2023 09:21:36 -0800 From: Gleb Smirnoff <glebius@freebsd.org> To: Mateusz Guzik <mjg@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: e1e847374bcc - main - Add DEBUG_POISON_POINTER Message-ID: <ZWYhoEZSRqgvKKOF@FreeBSD.org> In-Reply-To: <202311281635.3ASGZeew027691@gitrepo.freebsd.org> References: <202311281635.3ASGZeew027691@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZWYhoEZSRqgvKKOF>