From nobody Mon Feb 9 13:00:53 2026 Received: from mail-pf1-f227.google.com (mail-pf1-f227.google.com [209.85.210.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4843F28A3F2 for ; Thu, 8 Jan 2026 17:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767892953; cv=none; b=QUxb88WJCdeAGMLXKTdfNLyGALe1qEUjTOzx+F1RT3Z6C/RFL6OK0qJPJl6i71GpuZoCHIvM0gY6duiw9evVkVDSS9/hWJx3Cb8zU7rbfSZpgtgSiC62HsdbUgKRnkaKLVWb2mpDWgEXMM+Wu6a9W7iD8ZUkxyJGyQvXSeO73X0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767892953; c=relaxed/simple; bh=CckKC6RZ+oPaTv9HyFuTRMTDCyj+fC6YhxQ/fz2Myrs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H7nodWsRy86s3Gciy1ktMuSLzXl4Lg9RkUy2BzQDgMaYrBaU8+6HjjCFM1gd2r+TqXKJRumtWaNeMnRQF5ySdp/dIhMhaelcW2/YfuUVgSS3fQGbMQv5bwfWGMkikzsIHj6sLHLYKsZ1Lhjt2k+ZcyLnkkMnSGYg+q6jR0nDbKg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=AiP22DXU; arc=none smtp.client-ip=209.85.210.227 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="AiP22DXU" Received: by mail-pf1-f227.google.com with SMTP id d2e1a72fcca58-81ddb954e91so15289b3a.2 for ; Thu, 08 Jan 2026 09:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1767892951; x=1768497751; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2QhEY7hgCdpB6RVRGnQ1mrXyT489vZO6/9jC3EwBTpg=; b=AiP22DXUhsrmiaFupdsP/BdQmi48/LcRIkhZup+vl04oAhIIGO5f3wtI1Vvf4zDr5L t6XPCJ8JfeFecK5zaYPyJylY1w+1LDWOe6mdgN9InyPZRjrC3R1dHdBE8WrbZnnPd7EO 6xePVJ+0GqsPYcM2ZGHUtrlrnwDN1akFcGuv/oqSdBFO8QiCuXIZyUceW9fnewn/Y0du dLZ3UldiavYwWU8X0ACyPoc9madfn4vPux124qYV8M1ioQ1WqR0Z9ddAYOvdQOH25RwT X0H7XTPdBnDhgF0qZpHCkK3cDftC7SFlIlkKCzkJSy9ADSomGPsTu4W3iv6tDisu06kx 6y4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767892951; x=1768497751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2QhEY7hgCdpB6RVRGnQ1mrXyT489vZO6/9jC3EwBTpg=; b=i6dBTOterP2rLtnYl8mxP2stsI+YOIOw3xt2YWX5dpa7ZpAt5IjnZw3Ma01QRpve01 1rYU1yeyN2TCNx2PmKuWcLFbmT5Q1Nf2tBFIoSsHjYz979kvhONN2FBfXFUi+RYlzEGO IrUR0aazozJyLsMuR8Lt0X4ertQb9hbWeRbi+RwVxRKCJ/7BLW/b0uIz68i6QArLxU/u /YXO5qnNxxqfUnuG+rTtLRLAfFc5TqC+duMIrqPe8tcg4iPJ5RK8jbZSaZfcSvwW1SJK q4t4EbwJoAlB6CMCaoOe9uUIZ8eiNSSysYFCEjDnXX1566Cu+cCW49j24o01jRlVv40Z uISw== X-Forwarded-Encrypted: i=1; AJvYcCWCPqAaNypEoDgT/KFlcgPOhWuPoSjXdSX+qR59ZTcwumeKgNqIwNc0SyPmjTMNgJr1wx4sEYLtP4nHlTc=@vger.kernel.org X-Gm-Message-State: AOJu0YzfWxDtpU9Ti/lhqQz0W6lDxpHDKicR0qSCFRMBmXtJsXGDdxNz OxeDoKT0mxslJm0d99yhXFIk0tBP4VlnzwsXjYaGwHgUpyjmrVB/+eK/vRjyyA0FUPaQn9gKHX7 dRJmf6xQXLeSreaj8GBLmYQIc+IQ946x/fyeI X-Gm-Gg: AY/fxX6AieQKlMnjcqO+2lBacqXrn/eRlVlcWRSr4DSe13Ymx3obvPtvZciHZ4Vi1Rn rwvxYg+QtczuZSZvOr9Jafn0bf417ODxpTMDomusrqjekRWVZRisxxKVS78BgwRnZbTe0YIAJCL RG/LD6vPHMIdyR/WRjUcdwet6lb3NIBdmBGBk0Vsicealyv/qWEh1I8KBX4nVJPD5heqzJwnKa0 g1sLtr1qFYW5YFUuXxe6rdKiE2yGnvWIoM1iDCMgM0zBPM8SP6Qqk+IjocYmCBdhGtExZfB0GV+ jAheKgPOLcLoLNPduC1YeDmhjUSNu5IFQMqaJIHdFElApXXR0TTwyzvdAVaaXJBAWo5spfkvKQg zjW2s+ifnFZzhKPSHm+45xYA0G7gyDeXWpUKwjkQodQ== X-Google-Smtp-Source: AGHT+IG6KNczYB0X/xd9Rc6/z8KE+B7GiusKbrx8S6lyyK2KJmERN2c2OQbFVpoYg/jZDIam4cmzYsw5IxpM X-Received: by 2002:a05:6a21:3996:b0:341:29af:3be7 with SMTP id adf61e73a8af0-3898fa60c6cmr4313070637.7.1767892950617; Thu, 08 Jan 2026 09:22:30 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 41be03b00d2f7-c54d23d7235sm78957a12.1.2026.01.08.09.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 09:22:30 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.6.120]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id E83EB34059B; Thu, 8 Jan 2026 10:22:29 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id DD892E42165; Thu, 8 Jan 2026 10:22:29 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Anuj Gupta , Christoph Hellwig , Caleb Sander Mateos Subject: [PATCH v2 1/3] block: zero non-PI portion of auto integrity buffer Date: Thu, 8 Jan 2026 10:22:10 -0700 Message-ID: <20260108172212.1402119-2-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260108172212.1402119-1-csander@purestorage.com> References: <20260108172212.1402119-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The auto-generated integrity buffer for writes needs to be fully initialized before being passed to the underlying block device, otherwise the uninitialized memory can be read back by userspace or anyone with physical access to the storage device. If protection information is generated, that portion of the integrity buffer is already initialized. The integrity data is also zeroed if PI generation is disabled via sysfs or the PI tuple size is 0. However, this misses the case where PI is generated and the PI tuple size is nonzero, but the metadata size is larger than the PI tuple. In this case, the remainder ("opaque") of the metadata is left uninitialized. Generalize the BLK_INTEGRITY_CSUM_NONE check to cover any case when the metadata is larger than just the PI tuple. Signed-off-by: Caleb Sander Mateos Fixes: c546d6f43833 ("block: only zero non-PI metadata tuples in bio_integr= ity_prep") Reviewed-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- block/bio-integrity-auto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bio-integrity-auto.c b/block/bio-integrity-auto.c index 9850c338548d..cff025b06be1 100644 --- a/block/bio-integrity-auto.c +++ b/block/bio-integrity-auto.c @@ -138,11 +138,11 @@ bool bio_integrity_prep(struct bio *bio) if (bi->flags & BLK_INTEGRITY_NOGENERATE) { if (bi_offload_capable(bi)) return true; set_flags =3D false; gfp |=3D __GFP_ZERO; - } else if (bi->csum_type =3D=3D BLK_INTEGRITY_CSUM_NONE) + } else if (bi->metadata_size > bi->pi_tuple_size) gfp |=3D __GFP_ZERO; break; default: return true; } --=20 2.45.2