From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (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 B165C2727EB for ; Fri, 21 Nov 2025 19:40:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763754009; cv=none; b=pFYj0VpLot4RMAOWwHbxKa/NPBZRyJThnLg3SARrqOE/8P//xBzOTiCesmRwP8MDu5KTvpYjqtxudlHteueQxsOmvoWH8Y7+dbamDq8EMkj/bKxEI3hlJM1h3BWK0us9MG6U9zQTydLh/xf9ZSNqiD2ZR1zHPpYGG1di4y9tSwk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763754009; c=relaxed/simple; bh=uyjlPQjCUIP3tN/i8tzIaK5s2tBhsnrdcDrEmNw41BA=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=eJsVJ+BB5fADYE4gNYaq5H3yeCyuqFKkuOpFy5M7RUbqgSNSvaXMAG42leRA0x4t1HMSw91EcVYItlh1YVYOGHC8EAINlQs7QYKUGTHPM8beBeHkcUf5C0rHFIuJpo3y8NuM2oSgN0dpyrhm3uhMDLDVDQOfhMJa9WN3fzv4u+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--morbo.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Oh9GCWv4; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--morbo.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Oh9GCWv4" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-7b6b194cf71so5557856b3a.3 for ; Fri, 21 Nov 2025 11:40:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763754007; x=1764358807; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=MVJsPQnIVZajk+lHlfDveIvLKD+85UYee4pfqF03cLk=; b=Oh9GCWv4CQANsIIeECxGGV0IwE5Tt9lptae69cWvOBMZ+6adQiRjN9lxB0OT3ZLKk1 xhhj88M0EMvXh/m9k0SaihOtkWlZZ7BvEy2p23JtQlri04IrfhfTBWSh2XPKN8FyvIR7 taxM358F45Y2UR7uY0IQLnDoxd5IXIdfysoDYAS5d9pXx1ERUb8+LYWU9w3uOfW/7uB4 S6Z+mLgnVMhi+VekTPtv1z7WcF3SL4A2rDeIYyHUkD3+aNdgrS69kwpBl76N1xIpjAum KBOlbJAdMdU7o/q9SMV+OmiqKSX8+kggTm57fLhVT+fh9jSInT3UuomUrs/f2+tuGUB2 2osQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763754007; x=1764358807; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=MVJsPQnIVZajk+lHlfDveIvLKD+85UYee4pfqF03cLk=; b=u5xDU0BILANIC243rEi883wN3hruyFc4ArnMejX5mistyXupmAoMhqnVIBSrUetGLO ujbqAeO4kWwJR1gP8SyEgJIn7RGqlA54XhYstrgA+PY5BYujzVMRWK2+hJd2xwQzPvvQ YA1liyc7GTEaov0TMwI4qjvsOaFHD50St/CuGwT7kbq12FBIh6KTPIDa1rMciDXLHuwG CBKmfTrQMmTYD/6nkxx7+ChoQfZ6fbCEU4EZ1PtWasO7mWyOVhXvcSgGU4tGmKIcFdll ZGtMgwuphPhn+9MX2uXa6rjGxqgoCzWjCt9Ss3vEem/RJ3Riz3a9XyrsQv5BGo+PsXaG G1iw== X-Gm-Message-State: AOJu0YwkjN74Q/nCzVa8x0K3hCjY39ZNfbN85/Xd9uANenrgcbNAkdZg vJC1O7fjt9nmVUGWt2EjlVi7WJQr6sFIGsCC/D/BweUSlNZ8jG3mEPhKZDkHZoI1ZlWjH9+oWsi YLLf02vfk0GZ6kzkPfDZJoJyaf/THJtvKqxvLywEhRpUSaHmWG3hiHGf48+c2PdBImQxbgDyGaL ujXt3/BUFbFHEIeGH3qdJx+ZgJMQ1ekZ1M5M4xlA== X-Google-Smtp-Source: AGHT+IHarLcIknxetIYeUvDf3MVSiAq41e5Mrh95YVro6zYarTxgqBJdpBdWXVnAePgCSrupRn3actC+TQ== X-Received: from pfbfa5.prod.google.com ([2002:a05:6a00:2d05:b0:781:26f4:7855]) (user=morbo job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:158a:b0:35d:1bcd:6882 with SMTP id adf61e73a8af0-36150ea818emr3944453637.23.1763754006657; Fri, 21 Nov 2025 11:40:06 -0800 (PST) Date: Fri, 21 Nov 2025 19:39:42 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.rc2.455.g230fcf2819-goog Message-ID: <20251121193957.1655580-1-morbo@google.com> Subject: [PATCH 0/2] Add __counted_by_ptr macro From: Bill Wendling To: linux-kernel@vger.kernel.org Cc: Bill Wendling , Kees Cook , "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Justin Stitt , linux-hardening@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" These patches add the __counted_by_ptr macro and then uses it in mm/memblock.h. The name of the __counted_by_ptr attribute is the same as __counted_by, but two different macros are needed, because of feature skew in GCC and clang. Once the minmum versions of the compilers support 'counted_by' on both flexible array members and pointers in structs, this macro will become obsolete. Bill Wendling (2): Compiler Attributes: Add __counted_by_ptr macro memblock: annotate struct memblock_type with __counted_by_ptr include/linux/compiler_types.h | 11 +++++++++++ include/linux/memblock.h | 2 +- init/Kconfig | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) -- 2.52.0.rc2.455.g230fcf2819-goog