Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4971536rdb; Fri, 15 Sep 2023 19:56:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgKTOx1bmNpEMnqRLyxGlb8S3NkrJAGGykiuaxxo19PsH/qJeWbuGPaq5NQ45SHbAH5gf/ X-Received: by 2002:a05:6a00:1882:b0:68b:f3a4:ff6b with SMTP id x2-20020a056a00188200b0068bf3a4ff6bmr3871395pfh.9.1694833004225; Fri, 15 Sep 2023 19:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694833004; cv=none; d=google.com; s=arc-20160816; b=AYn6hxV6r1aIxgOoK/VLVyhN3bptE1FM7vriEeuLj7q7su4jeXx2xcxvdXZq2KF79m AFBrr6vMYI+82wf0qxdIqyL9AgxqBH2llHJBsZ5vfofswmr7a7aJp9J0Ym+AzhdmWFTL VSrmzZeAA3PKAhwFn0SPW6RQQUD45+Afbs+c22lnn2y8tpfXuSNrwJXcVyFAJjW0lyxx wPovOuFZ4g1ADIyzbN1WzQ0/Pa4oBmqrxz8ohHbLlwwFOJhH8xaNrxCcfGXn7O66ZEQ/ JNy0yhtXPTF92/oQaCWbMCi9gwR3Gw6yNYnn/wjslYyArlqd27hanJzCKeNe97l5hGaR xwzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=IwqMPyk1AnxpjwxRb2+p36Q5q6u/BphSF/nccRVsaQw=; fh=wlwZky9iREnPf6ywCUDRM3lHvHf+UrK4koJ4yhMZgXY=; b=ZoLzHq81hRVWdKuL7MZ8/ZV66un711EEOq7SaV+za6SIHIavXY3mp2CZUBW9SBAY7N 4EvFIp/YsVHaAeBj2OEHhBKBVCXzvhGk+Y9mOJ9lxhpC6W6tQN7ka1Ozy/1ojCvLW5Wd /RRxwPpR1cR8bDvMbNABp2Wh6EwDcAP0V5Hzwu8Llv/nvEgzdOK9c2ltr+xX1GMUM505 j/5W+k0P49DY/sMcBvvB9/y1jOUawJOrL2YG1oEtPsz6MQxOne0FD1oH9IFEEinXfKbe 3ELsFS7ThF5qgm8BpPWRWypSSyKdFXq2OEgg53NOOXkVwaO3lIQB6VrmJ6whWzRA0Bdq LR6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Sy1stqEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bz16-20020a056a02061000b005645bbe3ffbsi4509221pgb.577.2023.09.15.19.56.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 19:56:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Sy1stqEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F0826836E004; Fri, 15 Sep 2023 10:23:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235327AbjIORWo (ORCPT + 99 others); Fri, 15 Sep 2023 13:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235746AbjIORWQ (ORCPT ); Fri, 15 Sep 2023 13:22:16 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30410272D; Fri, 15 Sep 2023 10:22:02 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-502e6d632b6so3480965e87.0; Fri, 15 Sep 2023 10:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694798520; x=1695403320; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IwqMPyk1AnxpjwxRb2+p36Q5q6u/BphSF/nccRVsaQw=; b=Sy1stqEIuNlpAj20ugkHzO5umd5iOCAqQ4jGa1iE2H6df5epGhHk2ATWrtdNIN0gsE cfV9IhHSFnBD7KF526M6TOUN3EJ5y1Sa7rPEiRsfw+/jcf6DuoVDnl2xCFSngqYVGCfh mAusWgx39QOab96mDwoNQt1GVknSx9/8R1v+8hUCoySen9+MaQ+ZSlzLA9tUar99cOzS akJtN1w8yW5pxJJwgPaYvgLjXWG2LSxX3P8so5dOtx1K+Na7lFG81/PSgaIG9ySMCla5 /mJu2myDL8a2U6WJcGsETj0uaP8horBF9Gm9j2p7b2RbTs4vOvvFOlkYal+WTtmPsqMq KRyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694798520; x=1695403320; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IwqMPyk1AnxpjwxRb2+p36Q5q6u/BphSF/nccRVsaQw=; b=oyofJXWkPhZfqYkVcKx41hjHobBLCKGukaOj3djqSbkGWprp5fF38h3Id4oUw9R0SG g/Q8IbTk/0Ls0YGJ7ZIvZInQtO06VQQ4yNHEwpGo/66vOaeOC4de3dN1ESEJEysfqmd7 tg/b0RCSGydT2z7fSZ+PPTyMZ82LffjWgt62Lnb44bDjf6mMOs85qiF1bWaE1WKEA1uC POIPwum/UZ6B2gdKpgBy1WqSCNO8rx5jKM+8D5HDiYX+QjzwyRkS/Pp3fPRZaSWs8c6G nUuGE6dil8VcuPkXkVKcYRBdS9yQvn0jI1uK0HFviYgd63ku53rDOLgzJpgfQFAxq3cb qh+Q== X-Gm-Message-State: AOJu0YwnUhhOIwPnCQ9pyv9XFb3dXFJGwAV/BRme3xgsFVgpYVGfa49x Sx93OHK4x75wfaVDzfCnjgbXiGgEeg9TfsHgOTQIGIp7 X-Received: by 2002:ac2:4c85:0:b0:500:adbd:43e9 with SMTP id d5-20020ac24c85000000b00500adbd43e9mr1720618lfl.15.1694798520011; Fri, 15 Sep 2023 10:22:00 -0700 (PDT) MIME-Version: 1.0 References: <20230915-bpf_collision-v2-1-027670d38bdf@google.com> <20230915171814.GA1721473@dev-arch.thelio-3990X> In-Reply-To: <20230915171814.GA1721473@dev-arch.thelio-3990X> From: Alexei Starovoitov Date: Fri, 15 Sep 2023 10:21:48 -0700 Message-ID: Subject: Re: [PATCH v2] bpf: Fix BTF_ID symbol generation collision To: Nathan Chancellor Cc: Nick Desaulniers , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , LKML , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , stable , Satya Durga Srinivasu Prabhala , Marcus Seyfarth , Jiri Olsa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 10:23:13 -0700 (PDT) On Fri, Sep 15, 2023 at 10:18=E2=80=AFAM Nathan Chancellor wrote: > > On Fri, Sep 15, 2023 at 09:42:20AM -0700, Nick Desaulniers wrote: > > 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 t= o > > 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 > > Tested-by: Marcus Seyfarth > > Debugged-by: Nathan Chancellor > > Co-developed-by: Jiri Olsa > > Link: https://lore.kernel.org/bpf/CAEf4Bzb5KQ2_LmhN769ifMeSJaWfebccUasQ= OfQKaOd0nQ51tw@mail.gmail.com/ > > Signed-off-by: Nick Desaulniers > > --- > > tools/include/linux/btf_ids.h | 2 +- > > Shouldn't this diff be in include/linux/btf_ids.h as well? Otherwise, I > don't think it will be used by the kernel build. argh. Let's do this patch as-is and another patch to update everything in tools/../btf_ids.h, since it got out of sync quite a bit.