From nobody Thu Feb 12 09:32:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAF3CEED621 for ; Fri, 15 Sep 2023 17:36:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235599AbjIORgK (ORCPT ); Fri, 15 Sep 2023 13:36:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233285AbjIORfh (ORCPT ); Fri, 15 Sep 2023 13:35:37 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5ED330C1 for ; Fri, 15 Sep 2023 10:34:37 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5924b2aac52so31847397b3.2 for ; Fri, 15 Sep 2023 10:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694799277; x=1695404077; 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=XJJJkdYQoV+TuxyICMmymuiRvcaqdo/oW6N/B153WLE=; b=Hz8jyX9trB5SbK12NzI2q1kW8Cf/npNWwmFvDkY+H9qRrI4zEJ2hTZqhmA6ki3V85n gXXHSCi2mR3seK/b7NF9GXcCvkBZT1vhiPcmsYvx8iV7+e8YxV0IHvgJ3/jsNS1wlAUH FPJpwifjOuHdQeHeMefLGDqcd232Ad/3yDAsvsDN4fuFZ65t6EAe2bHH4gmoXDiobC4A LZSQsAS5O+bN2wRTQEJRzD0NNUE6nbimgOFZQv+DEs+5J4TP32JEPrtAksm2kKShh+b1 Sf4EPVxAV7c8ln1fa25+5xJ5k1ZWRtsw8QTGo8uUVOP6hRvBd10dfC0sx46izelumbaU bCIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694799277; x=1695404077; 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=XJJJkdYQoV+TuxyICMmymuiRvcaqdo/oW6N/B153WLE=; b=a+nCklApPnpw8kkUNttTk8phcKUX7xwSjvdKvWtoItKqcij1VjiGZOw6c5vRtaivza 58zGeMxrnnZaF9BDaE6A0tzrwbGnSg1m7gcBaGqEYpJN5QGGUAQNh4buN3BkatCQeHMW Ojte0jN/j/uPgqc/UtXS2E4J59HJoPqZIGAY/qMJSqQ+ECaq6ik+RRDFb8jJFBr0Q48t GDwE3JpLxwQ2OJab0D7mpwnnD3q4dT/WbkRtrVFFmHE0mtH/yX9tzPtt038umFfKO693 vIjSjHkhNv1diIH017N3lgzE9NN/UGG8Y+XO16fYq7plZHaFVKsHLBs6RbIDF24OA0X/ 1ejA== X-Gm-Message-State: AOJu0YylJ2caJmiy9ZiiSrA8NDOega0gNAmz1L4pCzhqLIpoD9kMjYaC 87YOXP6ueWWIYmnatTZYz1wE2bV0tcbbdA/5EHw= X-Google-Smtp-Source: AGHT+IEAHmjL5dTMrhswiFhjsYks3tmeFWHVYfPFl5tpcAmcDOUwNVDZ9Oub8FCz1WrA9lAgdMaDDhBi7ijkvR//Z9s= X-Received: from ndesaulniers-desktop.svl.corp.google.com ([2620:15c:2d1:203:7f04:6b3:b482:dd2c]) (user=ndesaulniers job=sendgmr) by 2002:a25:804f:0:b0:d81:7f38:6d69 with SMTP id a15-20020a25804f000000b00d817f386d69mr56369ybn.0.1694799276916; Fri, 15 Sep 2023 10:34:36 -0700 (PDT) Date: Fri, 15 Sep 2023 10:34:27 -0700 In-Reply-To: <20230915-bpf_collision-v3-0-263fc519c21f@google.com> Mime-Version: 1.0 References: <20230915-bpf_collision-v3-0-263fc519c21f@google.com> X-Developer-Key: i=ndesaulniers@google.com; a=ed25519; pk=eMOZeIQ4DYNKvsNmDNzVbQZqpdex34Aww3b8Ah957X4= X-Developer-Signature: v=1; a=ed25519-sha256; t=1694799273; l=1627; i=ndesaulniers@google.com; s=20230823; h=from:subject:message-id; bh=Un0BK6Kn/Y9x5wHtdOd6qUrWjso13vQumzj2rjmjBdg=; b=5rueaC75pOHuA1brjat1Uh1IHpP8UpGk090yWGibirzkwVfVTSK3QKijrRtvJGvRfelm2Ou2H XSO66QfARkFC4DnKw4VJgK1+C1hdJdgOulmLsUL76zhBZiawI1HpDVv X-Mailer: b4 0.12.3 Message-ID: <20230915-bpf_collision-v3-1-263fc519c21f@google.com> Subject: [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision From: Nick Desaulniers To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Jiri Olsa Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Nick Desaulniers , stable@vger.kernel.org, Satya Durga Srinivasu Prabhala , Marcus Seyfarth , Nathan Chancellor Content-Type: text/plain; charset="utf-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable From: Jiri Olsa Marcus and Satya reported an issue where BTF_ID macro generates same symbol in separate objects and that breaks final vmlinux link. ld.lld: error: ld-temp.o :14577:1: symbol '__BTF_ID__struct__cgroup__624' is already defined This can be triggered under specific configs when __COUNTER__ happens to be the same for the same symbol in two different translation units, which is already quite unlikely to happen. Add __LINE__ number suffix to make BTF_ID symbol more unique, which is not a complete fix, but it would help for now and meanwhile we can work on better solution as suggested by Andrii. Cc: stable@vger.kernel.org Reported-by: Satya Durga Srinivasu Prabhala Reported-by: Marcus Seyfarth Closes: https://github.com/ClangBuiltLinux/linux/issues/1913 Debugged-by: Nathan Chancellor Link: https://lore.kernel.org/bpf/CAEf4Bzb5KQ2_LmhN769ifMeSJaWfebccUasQOfQK= aOd0nQ51tw@mail.gmail.com/ Signed-off-by: Jiri Olsa Signed-off-by: Nick Desaulniers Reviewed-by: Nathan Chancellor --- include/linux/btf_ids.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h index a3462a9b8e18..a9cb10b0e2e9 100644 --- a/include/linux/btf_ids.h +++ b/include/linux/btf_ids.h @@ -49,7 +49,7 @@ word \ ____BTF_ID(symbol, word) =20 #define __ID(prefix) \ - __PASTE(prefix, __COUNTER__) + __PASTE(__PASTE(prefix, __COUNTER__), __LINE__) =20 /* * The BTF_ID defines unique symbol for each ID pointing --=20 2.42.0.459.ge4e396fd5e-goog