From nobody Tue Nov 28 17:23:35 2023 X-Original-To: dev-commits-src-main@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 4Sfq6x5p7tz52GNw; Tue, 28 Nov 2023 17:23:37 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oo1-xc2a.google.com (mail-oo1-xc2a.google.com [IPv6:2607:f8b0:4864:20::c2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sfq6x3cH7z3gTw; Tue, 28 Nov 2023 17:23:37 +0000 (UTC) (envelope-from mjguzik@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-58d439e3e15so1839103eaf.1; Tue, 28 Nov 2023 09:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701192216; x=1701797016; darn=freebsd.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bMbbVlv6g9UrPMlKPvVqHttK6r1mfY5hboyulsh7BOA=; b=lrmprMPvOW6U9a1MQMuylMD+PthgU7cmhr6iUrTRKqJtYnC7wJh95XIzNNvv0IZHf6 tbg+zW8WNQyKqxNNX1mbFa6ZlYxBOjM7lpakIwuWp5qW06LLOERAdme9kPc2G3e1w3gH 1aBdvF0KibFOxEFn+IClJMD7nFhA+3Th5H9ynbveiCUTr+rIReflzUorYNzdZU4R7NYa 30mUbIrKPlYnhXgZ/OzvK6ZQE3ZR/0HqvAc6lc3uWUr7Q7jsNDgaeedWrCRZGIU3GY6J F0kwh02k5k4nTwKVExP38OrugTNKJYCQr4m+izgS3xPKEgmWSFKNm7J9RotV0WnOtrtk kMzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701192216; x=1701797016; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bMbbVlv6g9UrPMlKPvVqHttK6r1mfY5hboyulsh7BOA=; b=GamfDgtNfvudYNXIn/bK5a/dN0M7kL2CqCp8bQjt/NQekL3a0uMuCTe7N3+tp/4rV+ hUuN3miY6pfnMaPLsZqdhbhYfpDDKGpQDhfrIgiSenDZekdJqgOUIN57g7ExI6yqb0iQ B90p/kjccJ2vZ8CnhbXCKjrPjxI+kjw8Vml+Ufdv5FrLrcWpHh7BSPbTDE8L7t2JT98w EjRF2lo3vremo00e59T+35+cMYj79ewlwGvQnn1TSFCchUr6zT274OQTB7JCL6XrpICi Foh6V32XBARBOzfEaiaGvFy6m1apt8+RH4OVKyep+vfrjMWjbBC79dTJSkpcSY/OH0lb vakg== X-Gm-Message-State: AOJu0YwXDD4uLM9stTLzfXxebzhB75aeMBB8NNW/+eeNVAJQYyn1oF2R jfsjH39bUgisqkE85Gs4OWYrh6hJgwHpZCYpsTC1XnnPOtA= X-Google-Smtp-Source: AGHT+IGlQ2TzuxzE9eZav3qAFMlBmwE4U/gHsffts68uDAHsoW+shh+uYbtyODKsUxWEfpnEuBYLNbMeKMYSfaDho4Q= X-Received: by 2002:a4a:a645:0:b0:58d:6bf6:4daf with SMTP id j5-20020a4aa645000000b0058d6bf64dafmr5505292oom.2.1701192216350; Tue, 28 Nov 2023 09:23:36 -0800 (PST) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Received: by 2002:ac9:6c8c:0:b0:4f0:1250:dd51 with HTTP; Tue, 28 Nov 2023 09:23:35 -0800 (PST) In-Reply-To: References: <202311281635.3ASGZeew027691@gitrepo.freebsd.org> From: Mateusz Guzik Date: Tue, 28 Nov 2023 18:23:35 +0100 Message-ID: Subject: Re: git: e1e847374bcc - main - Add DEBUG_POISON_POINTER To: Gleb Smirnoff Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" 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:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Sfq6x3cH7z3gTw On 11/28/23, Gleb Smirnoff wrote: > 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). > unmapped_buf is caddr. if you want to roll with void * feel free to change. -- Mateusz Guzik