Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4767763rdb; Fri, 15 Sep 2023 11:34:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6FxiES2tAQTZq8llSekO7OitRM4gX61gXZgz8QL/kGR991Pg1A6RwxuoDoE8JUz3a3B5F X-Received: by 2002:a05:6a20:158a:b0:149:97e4:8ae4 with SMTP id h10-20020a056a20158a00b0014997e48ae4mr2873335pzj.0.1694802853523; Fri, 15 Sep 2023 11:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694802853; cv=none; d=google.com; s=arc-20160816; b=J5dQCLzHwOg/fnjVt+urMHT6tbBaWA0u6a6TWt5ahOvE2r690hXYDdj5qVgA1GBHQd dXAaLZfomZCGQbOfj/lQkOodroEYdADZD12VOv5JkMdRqmjXkqik7WLavsBJS4prUJIa Pg5mpO9/3Udzozp/kSMN1YGKExqkHbGJwolEh3W9f5OUXiXnzS4FEI4vjODx697gPk0C x17dgl1Cd3lfdDHiDW/XWrkX1j2J2RzCmgHpTf+/elA71UeyOvxZPnq70kIuxdNuQV+/ ryW/cfdp/ytaGKBoNziQrwjMKE8FX7adIViOWhUlr+HN13/XMbmGU1lzLF1m/FXtp5Su lktQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YXFJlm++jBtmXwlyWfWPMEoGkPnbu2fFjl6Br11Zl+U=; fh=Pyv5pex2vEIM8Ko261rSXUfpo6Cv4j8PJYynJyvz1JQ=; b=dBXezDbdACLqwbDYeUAdrJMc61BvcY9WroMRGLed+VQkFd+8qDXhQaVCDuW1hYe0lt 5pCALDQrJdg9V+dW5NHlh13HgwDP45gq3OePytJqxOcaBd+cyLi82xx/df1Ji+nRqWPJ HreBNFQ4AkMbm0n/IFBehfW0egrDfsJ7t2Vz2htq2VGqxT9t6EE+nBDJyLvdFYwb7AVr WqTWzj8XksyLHiSsMl2LRj4jMzW62r7I+HGnuYZmEUFTEr5It9PomApWnsboRQfa3/Ix uYjAk1ewGXgWiuBCI8tnrCvCAZyVh1xRMqpcGGa47LaK/IR6/iYUQE+192j9SQXbVwWh Skgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="d/72teB7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id 76-20020a63004f000000b0057777451a73si3716754pga.703.2023.09.15.11.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 11:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="d/72teB7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DC0B480722C9; Fri, 15 Sep 2023 11:31:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236422AbjIOSav (ORCPT + 99 others); Fri, 15 Sep 2023 14:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236582AbjIOSaR (ORCPT ); Fri, 15 Sep 2023 14:30:17 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07A921FD7; Fri, 15 Sep 2023 11:30:12 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76465C433C8; Fri, 15 Sep 2023 18:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694802611; bh=wbnJo8rFizU3HAyVmJkb5mTxsQnJcT5sgSZwMnt/Su8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d/72teB7kMJ3Y5PTQUPYA1iDWaFjQn4n7PQkMSnEaeNmM2HvymvFNd7VWLnGwpqhS WWFLON3vKsiU6RBXxBtrB5BX57qhAFgWwzRj2Op/p6zl4VIf/1xbLvcBaKgTchc21R phqhYJ4IbejtsSu9yvB76uBvPpnoYaAfKp2NdIZpbsBjDJPcJ12w2IVcJje3kRRtR/ ILQ2S27EB9WVv3QbBIUUqHmn+xwEjgZpZD4hfKTvpXz45r4/uZGr1yqyE3leBGt+6f 6Usxkzu2JDe3//pzWURqJph/X5gHxkpgcv41uu6e3yQAXJfHO+z79+9xOxK8SgmL17 yfvlEBniTNh9Q== Date: Fri, 15 Sep 2023 11:30:08 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Jiri Olsa , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , stable@vger.kernel.org, Satya Durga Srinivasu Prabhala , Marcus Seyfarth Subject: Re: [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision Message-ID: <20230915183008.GA17653@dev-arch.thelio-3990X> References: <20230915-bpf_collision-v3-0-263fc519c21f@google.com> <20230915-bpf_collision-v3-1-263fc519c21f@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230915-bpf_collision-v3-1-263fc519c21f@google.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:31:32 -0700 (PDT) On Fri, Sep 15, 2023 at 10:34:27AM -0700, Nick Desaulniers wrote: > 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_LmhN769ifMeSJaWfebccUasQOfQKaOd0nQ51tw@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) > > #define __ID(prefix) \ > - __PASTE(prefix, __COUNTER__) > + __PASTE(__PASTE(prefix, __COUNTER__), __LINE__) > > /* > * The BTF_ID defines unique symbol for each ID pointing > > -- > 2.42.0.459.ge4e396fd5e-goog >