From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (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 789662D595A for ; Sun, 9 Nov 2025 13:25:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762694718; cv=none; b=r5/P1JDKUzKG1479m2wTJw2wLAu845NNw2D8nnSrMu7lX3XKkKNKehpnQZUfPm7zwalNnAOrlTycdDvGs4wa5nuVvpDoYK7GKHwClsK9mqLjWiGt+ICXEvcsMgfDH1DfJmWItvhI9r1UKRpTwXR22T3aJJ0LhE7jftvi/EQcAew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762694718; c=relaxed/simple; bh=a6Mm4Izv/l2Vj4Lk4uIhAUntZzlpFUu5dR42KJu4KxI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lkAB+xJePoJ6TEgMi0DUIrCvzzdQkEVEgHdFGjLooHBwUDJj7r/nYUsDgxM2hwV1useb38C9mFiSyiSREcxbC8f5e0v49R2nzgAjZsHxuQLDguVOdG4JvL8cuvFxZhL2WvWvH/7LKKux2DCJbfE4Fw1yNAx6rm/Rxiz0ia7SZ6k= 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=nsLEKn9R; arc=none smtp.client-ip=91.218.175.170 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="nsLEKn9R" 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=1762694712; 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=+7YL1GuAIPNyLjQq6TclNsLYD8AzM0YeDoT6kWQUrj0=; b=nsLEKn9R5peSkPpKZVkQZX+lcRXX9jWPKMof1BYqA6YzTkGP8+pKrcwLVPmNh0HsDl3Cc3 dTlTTVDelPepoWg7AD+iO4DOAAHG2f/xXf/8mqqK+36sCzakiaYDpkaAoI06TIXZ1HmvRB zO2p31ciLstdRmAoJ6d9KvuuwRSbKro= From: Thorsten Blum To: Kees Cook , "Gustavo A. R. Silva" Cc: Thorsten Blum , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] fs/xattr: Annotate struct simple_xattr with __counted_by Date: Sun, 9 Nov 2025 14:23:51 +0100 Message-ID: <20251109132356.473873-1-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Add the __counted_by() compiler attribute to the flexible array member 'value' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Signed-off-by: Thorsten Blum --- include/linux/xattr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 86b0d47984a1..2d0ccf99ee75 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -114,7 +114,7 @@ struct simple_xattr { struct rb_node rb_node; char *name; size_t size; - char value[]; + char value[] __counted_by(size); }; void simple_xattrs_init(struct simple_xattrs *xattrs); -- 2.51.1