From nobody Wed Apr 1 22:00:05 2026 Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) (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 942AA3CEBAC; Wed, 1 Apr 2026 14:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=130.117.225.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775053232; cv=none; b=lgz1mJ2NFHbqtBmS8qYFfJWgHWh6qWf28aPouBKJM+LTuSf3J6jz0Ze5fPso/Tt3KPWvjzKucVivyNlmHOgJCs2MT0ScJS1udqHth8pNzbwHDZ7pQuZuQobYzmuUf80vRkcjp/wa6/ulWktcfxvL0jDDjpLxYBrkAz6cMdS3Mf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775053232; c=relaxed/simple; bh=pfgVGDgPPhXVTWpuZF/LlQPzPd5D5CTCfpW+uxpq64g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TvFqV/bPaoIIdRSvWf1R7IvGoeWEsXi+7K9lfjHjQzSRnttGioO6s+wm8RryyFTn550tawBlbGlaIWFiK/oHNikx7/glTcK1jV5RS0OazTNP8OU/P5XpSuARvy2t5FpP4Rp1IU2Ieoeuwnp4geH8VknNWquGWRlA/aMoWkNXIF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com; spf=pass smtp.mailfrom=virtuozzo.com; dkim=pass (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b=UM+Qowfr; arc=none smtp.client-ip=130.117.225.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=virtuozzo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="UM+Qowfr" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Message-ID:Date:Subject :From; bh=yx8315qT6qYcNHYrSQC5idH5MKNb4uq1YT/n0BZxwKA=; b=UM+QowfrWEtR2+h0GIe mCFfsfyHARADts+LsmwvUIHndehJzPKJo8sxyf7ajXLczHJ8f2aDns1ZalPjitTUlUvdAhAUD721G b9ETpd5O7OVe4O8VP82lcP3UqnnkyoJuDYSiyoNXQv/uQvsusIyGldLDSpkIhE2X3+TAcn+DL4Puz LVAm4E3l1jj53PCLIZfaQxcKM/toBHWA5El3yqYqKXyjrtiTccdV/8IOyaHrA3ez2qz1R9hzwscsj R2b37KmBjFZU/625RwmE1arrmho2UW94sXv8mQC88kVhXUJM+YcPtvViOJM+jicOsg2j/OPjz2Uz+ /4vvMng/1GgylIw==; Received: from [130.117.225.5] (helo=finist-alma9.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1w7wOW-00HGGD-0f; Wed, 01 Apr 2026 16:20:20 +0200 From: Konstantin Khorenko To: Peter Oberparleiter , Mikhail Zaslonko , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Cc: Steffen Klassert , Herbert Xu , Masahiro Yamada , Josh Poimboeuf , Vasileios Almpanis , Pavel Tikhomirov , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Konstantin Khorenko , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Arnd Bergmann Subject: [PATCH v3 1/4] net: fix skb_ext_total_length() BUILD_BUG_ON with CONFIG_GCOV_PROFILE_ALL Date: Wed, 1 Apr 2026 17:20:17 +0300 Message-ID: <20260401142020.1434243-2-khorenko@virtuozzo.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260401142020.1434243-1-khorenko@virtuozzo.com> References: <20260401142020.1434243-1-khorenko@virtuozzo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable When CONFIG_GCOV_PROFILE_ALL=3Dy is enabled, the kernel fails to build: In file included from : In function 'skb_extensions_init', inlined from 'skb_init' at net/core/skbuff.c:5214:2: ././include/linux/compiler_types.h:706:45: error: call to '__compiletime_assert_1490' declared with attribute error: BUILD_BUG_ON failed: skb_ext_total_length() > 255 CONFIG_GCOV_PROFILE_ALL adds -fprofile-arcs -ftest-coverage -fno-tree-loop-im to CFLAGS globally. GCC inserts branch profiling counters into the skb_ext_total_length() loop and, combined with -fno-tree-loop-im (which disables loop invariant motion), cannot constant-fold the result. BUILD_BUG_ON requires a compile-time constant and fails. The issue manifests in kernels with 5+ SKB extension types enabled (e.g., after addition of SKB_EXT_CAN, SKB_EXT_PSP). With 4 extensions GCC can still unroll and fold the loop despite GCOV instrumentation; with 5+ it gives up. Mark skb_ext_total_length() with __no_profile to prevent GCOV from inserting counters into this function. Without counters the loop is "clean" and GCC can constant-fold it even with -fno-tree-loop-im active. This allows BUILD_BUG_ON to work correctly while keeping GCOV profiling for the rest of the kernel. This also removes the CONFIG_KCOV_INSTRUMENT_ALL preprocessor guard introduced by d6e5794b06c0, as __no_profile handles both GCOV and KCOV instrumentation at the root cause level rather than just disabling the check. Fixes: 5d21d0a65b57 ("net: generalize calculation of skb extensions length") Fixes: d6e5794b06c0 ("net: avoid build bug in skb extension length calculat= ion") Signed-off-by: Konstantin Khorenko Reviewed-by: Thomas Wei=C3=9Fschuh --- net/core/skbuff.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 0e217041958a..47c7f0ab6e84 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5145,7 +5145,7 @@ static const u8 skb_ext_type_len[] =3D { #endif }; =20 -static __always_inline unsigned int skb_ext_total_length(void) +static __always_inline __no_profile unsigned int skb_ext_total_length(void) { unsigned int l =3D SKB_EXT_CHUNKSIZEOF(struct skb_ext); int i; @@ -5159,9 +5159,7 @@ static __always_inline unsigned int skb_ext_total_len= gth(void) static void skb_extensions_init(void) { BUILD_BUG_ON(SKB_EXT_NUM > 8); -#if !IS_ENABLED(CONFIG_KCOV_INSTRUMENT_ALL) BUILD_BUG_ON(skb_ext_total_length() > 255); -#endif =20 skbuff_ext_cache =3D kmem_cache_create("skbuff_ext_cache", SKB_EXT_ALIGN_VALUE * skb_ext_total_length(), --=20 2.43.5