From patchwork Mon Oct 28 11:13:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thorsten Blum X-Patchwork-Id: 13853315 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C6A518859A for ; Mon, 28 Oct 2024 11:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730114019; cv=none; b=alNI2Rnyr2KzXEdQr3DDWB8oW9M0LukKcc1HnfMMQZOyt6H38DgzwO2g3KIStIFJGOKmVZL9gKyIQz2IgUjr2ZuRZdozORzIjE7Wkw8UYNZjzvphaLs0twE4b3tOYS1sx55L9WTVnbIb6t9v/7VCkO9YrvLbuYMi6PfHvMco/6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730114019; c=relaxed/simple; bh=NDaI99AhgBFWa34DzClcPAICbyApKXJLL06DCw7Bvk0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZQtoxpjpT1TZVZXbDq7RAyAvo7B59Wy8Q0TZc26g4X/97YUWkVqaicRysrtdvUBY+2iqABAG9ammtYc6puSmKZtLvARr5tnDFpiejr22t5lMwM+5roCLTY1l3LtbC0hR8KjPnAO1j7vpDHK7x4GlJrgIWRGBd4FKoHmfcO5UhAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=i/F376S2; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="i/F376S2" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1730114010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LzRs0q/0tQyiW8Vvg1wCm1ZdQPd1qYE7s2gqV/ibHLY=; b=i/F376S20eO5IHZaY+lVxqg+2yn/mriiP0DG5CSmYoOTi44u2VInsYFrWqm6UoOr5594Ga iJoaBy6Drrhrg3upCSVFPBFkgYJmZuvPHKo2ivzxyn/Q5e5zUC8Z3/0FlkRpBMHbcX+TLq 2iFkUD9z7R/fqLlHkUy0g2F6pUxwqbQ= From: Thorsten Blum To: Trond Myklebust , Anna Schumaker , Kees Cook , "Gustavo A. R. Silva" Cc: Thorsten Blum , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [RESEND PATCH] nfs: Annotate struct pnfs_commit_array with __counted_by() Date: Mon, 28 Oct 2024 12:13:12 +0100 Message-ID: <20241028111312.2869-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Add the __counted_by compiler attribute to the flexible array member buckets to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Compile-tested only. Signed-off-by: Thorsten Blum --- include/linux/nfs_xdr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index e0ae0a14257f..e74a87bb18a4 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1331,7 +1331,7 @@ struct pnfs_commit_array { struct rcu_head rcu; refcount_t refcount; unsigned int nbuckets; - struct pnfs_commit_bucket buckets[]; + struct pnfs_commit_bucket buckets[] __counted_by(nbuckets); }; struct pnfs_ds_commit_info {