From nobody Tue Nov 28 17:21:36 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sfq4d611Yz52GJ7; Tue, 28 Nov 2023 17:21:37 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from glebi.us (glebi.us [162.251.186.162]) by mx1.freebsd.org (Postfix) with ESMTP id 4Sfq4d3yjPz3fvN; Tue, 28 Nov 2023 17:21:37 +0000 (UTC) (envelope-from glebius@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: by glebi.us (Postfix, from userid 1000) id 1EA386FB4A; Tue, 28 Nov 2023 09:21:36 -0800 (PST) Date: Tue, 28 Nov 2023 09:21:36 -0800 From: Gleb Smirnoff To: Mateusz Guzik 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: References: <202311281635.3ASGZeew027691@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202311281635.3ASGZeew027691@gitrepo.freebsd.org> X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-Rspamd-Queue-Id: 4Sfq4d3yjPz3fvN 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