From nobody Thu Oct 2 10:55:47 2025 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (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 25AE93164D3 for ; Thu, 18 Sep 2025 14:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758204397; cv=none; b=s1D7ZR2DvO2/+CkLsQm6x4UyW1+yKrvCXsw8jPjfuf/vaEcge+bCp4LQeLi338KBVobNiS1BFJFrm3tY4XbR+2BtZRrm/hHtmal4TOsHthxDRLE9TtlnivFYI/sn1NaheDY4MQwqv50oAwSMpGHHUPjICAWiOCvguZ4U56qzq6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758204397; c=relaxed/simple; bh=SpUgVrjaDm3RLrxadQdn2hAFpCJXInTkIERb02PmxvQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=jJZCKzB0RfKpHuQJggSguE1TLfGm9SO704TF48yl9H1SyVasvXsm99oYZ0f0abYzvfW1E7nRpGHXkKwOqZX6PR3XUMte/kbVa94cU0BtEY09C0hWRSN5RQA0pfzztJ9gx2/+4X7DBctQxttTUE4uuBjHADlxNUbG0BduOMeZpgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--elver.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=L1uA/9VD; arc=none smtp.client-ip=209.85.221.74 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--elver.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="L1uA/9VD" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-3ee12ab7f33so265443f8f.2 for ; Thu, 18 Sep 2025 07:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758204393; x=1758809193; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=i8w2QAEoYIuf5bb1DymlH6d9mwXwlVHoZjcMp7ct6B4=; b=L1uA/9VDqbJaGdqqtHo/OL9pnsP8oet6onqIEH64y/qeODBcf7lSJZJSaH/hHRPYkY dlgrkhIeLf4I97h6NnGur/dlQ1RAPZqgw3VZ0GN4XdUVf5WTptQhyJyUTSvp4KZV52fM Lo/VEZRxHYlL02fc5oOgEv7OwFHaa4EeWB6ALKOU2ZzWmZgN8MiJcwSOn+mhSdj9JOzW HS8CbzdvYms6ni44YeEWBJwkI+5/AesME0Ss0qhiXunz1w1eMe29CL3GiYM2zA7KZIOu 42B99SWk4E1XN3oitKhOu19HTKdKpPYhjGcO3wd76hXf/opzI/F2RIxBb2baAbcZmuNk MWxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758204393; x=1758809193; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i8w2QAEoYIuf5bb1DymlH6d9mwXwlVHoZjcMp7ct6B4=; b=eHENVQh3dXddZONtcf/zHDiLbOas6G6QlJq+zX6lymCCdRJRLDsFTUw7cVaQIwFlio 3+Y9IYV/IIi7zK7IsDoAtoCKncyqKth8hSIzC/M47DMhgIlPAmr8okldQzoFJM6Hc90p kIFatamNBGACCPfI6R+fLggxj6jqgaHGQ7SiaboSzX9LCKAqzQ98T8MwFrNgkTKdsnGW 98y1RBZjl3qRHBopWhemP46H2MpTEXcm93FfyK4S7agT6no9ST4S4jr4SnNI57FXhLJs yNrjO/otWK8DpC/yy1ivlTjpPQ07dXHhIx5d5RomjysC+AvIr4/n9bLkvCDMfKZkrAZ3 GOpg== X-Forwarded-Encrypted: i=1; AJvYcCWdI59KuV8zbhcv0XwrS22CP7AurbptQnccqIU14aO7eyjB7D9N8QJzalRsiBC49DTBmJoyhqvW8neR8us=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4nSAbGZFFtufVlSyolnqge8y/fwSYfLQe8UzNlN/EYKShgLBl AMiabeCnllfuyp9Qh13Su1+K8+cW1hZYQUnZPOeQA38toutIks0E6wYCKI8ZB1LYqoSUwwJOeVQ rMw== X-Google-Smtp-Source: AGHT+IHWNzp66JVSJfWTxCRHilc0nDbHIqmddDpVoeLyiEVjC/MpaqVSH0JrUfOsI8FVYQkmBD96f8iDCw== X-Received: from wrbfr7.prod.google.com ([2002:a05:6000:2a87:b0:3e7:6467:c475]) (user=elver job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2506:b0:3da:27c2:f51d with SMTP id ffacd0b85a97d-3ecdfa5f1bamr5332225f8f.45.1758204392094; Thu, 18 Sep 2025 07:06:32 -0700 (PDT) Date: Thu, 18 Sep 2025 15:59:35 +0200 In-Reply-To: <20250918140451.1289454-1-elver@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250918140451.1289454-1-elver@google.com> X-Mailer: git-send-email 2.51.0.384.g4c02a37b29-goog Message-ID: <20250918140451.1289454-25-elver@google.com> Subject: [PATCH v3 24/35] compiler-capability-analysis: Introduce header suppressions From: Marco Elver To: elver@google.com, Peter Zijlstra , Boqun Feng , Ingo Molnar , Will Deacon Cc: "David S. Miller" , Luc Van Oostenryck , "Paul E. McKenney" , Alexander Potapenko , Arnd Bergmann , Bart Van Assche , Bill Wendling , Christoph Hellwig , Dmitry Vyukov , Eric Dumazet , Frederic Weisbecker , Greg Kroah-Hartman , Herbert Xu , Ian Rogers , Jann Horn , Joel Fernandes , Jonathan Corbet , Josh Triplett , Justin Stitt , Kees Cook , Kentaro Takeda , Lukas Bulwahn , Mark Rutland , Mathieu Desnoyers , Miguel Ojeda , Nathan Chancellor , Neeraj Upadhyay , Nick Desaulniers , Steven Rostedt , Tetsuo Handa , Thomas Gleixner , Thomas Graf , Uladzislau Rezki , Waiman Long , kasan-dev@googlegroups.com, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-sparse@vger.kernel.org, llvm@lists.linux.dev, rcu@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While we can opt in individual subsystems which add the required annotations, such subsystems inevitably include headers from other subsystems which may not yet have the right annotations, which then result in false positive warnings. Making compatible by adding annotations across all common headers currently requires an excessive number of __no_capability_analysis annotations, or carefully analyzing non-trivial cases to add the correct annotations. While this is desirable long-term, providing an incremental path causes less churn and headaches for maintainers not yet interested in dealing with such warnings. Rather than clutter headers unnecessary and mandate all subsystem maintainers to keep their headers working with capability analysis, suppress all -Wthread-safety warnings in headers. Explicitly opt in headers with capability-enabled primitives. With this in place, we can start enabling the analysis on more complex subsystems in subsequent changes. Signed-off-by: Marco Elver --- scripts/Makefile.capability-analysis | 4 +++ scripts/capability-analysis-suppression.txt | 32 +++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 scripts/capability-analysis-suppression.txt diff --git a/scripts/Makefile.capability-analysis b/scripts/Makefile.capabi= lity-analysis index e137751a4c9a..76ef93ce2466 100644 --- a/scripts/Makefile.capability-analysis +++ b/scripts/Makefile.capability-analysis @@ -4,4 +4,8 @@ capability-analysis-cflags :=3D -DWARN_CAPABILITY_ANALYSIS \ -fexperimental-late-parse-attributes -Wthread-safety \ -Wthread-safety-pointer -Wthread-safety-beta =20 +ifndef CONFIG_WARN_CAPABILITY_ANALYSIS_ALL +capability-analysis-cflags +=3D --warning-suppression-mappings=3D$(srctree= )/scripts/capability-analysis-suppression.txt +endif + export CFLAGS_CAPABILITY_ANALYSIS :=3D $(capability-analysis-cflags) diff --git a/scripts/capability-analysis-suppression.txt b/scripts/capabili= ty-analysis-suppression.txt new file mode 100644 index 000000000000..95fb0b65a8e6 --- /dev/null +++ b/scripts/capability-analysis-suppression.txt @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# The suppressions file should only match common paths such as header file= s. +# For individual subsytems use Makefile directive CAPABILITY_ANALYSIS :=3D= [yn]. +# +# The suppressions are ignored when CONFIG_WARN_CAPABILITY_ANALYSIS_ALL is +# selected. + +[thread-safety] +src:*arch/*/include/* +src:*include/acpi/* +src:*include/asm-generic/* +src:*include/linux/* +src:*include/net/* + +# Opt-in headers: +src:*include/linux/bit_spinlock.h=3Demit +src:*include/linux/cleanup.h=3Demit +src:*include/linux/kref.h=3Demit +src:*include/linux/list*.h=3Demit +src:*include/linux/local_lock*.h=3Demit +src:*include/linux/lockdep.h=3Demit +src:*include/linux/mutex*.h=3Demit +src:*include/linux/rcupdate.h=3Demit +src:*include/linux/refcount.h=3Demit +src:*include/linux/rhashtable.h=3Demit +src:*include/linux/rwlock*.h=3Demit +src:*include/linux/rwsem.h=3Demit +src:*include/linux/seqlock*.h=3Demit +src:*include/linux/spinlock*.h=3Demit +src:*include/linux/srcu*.h=3Demit +src:*include/linux/ww_mutex.h=3Demit --=20 2.51.0.384.g4c02a37b29-goog