Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14198673pxu; Mon, 4 Jan 2021 16:02:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJztaXpcVnhqJ80KvEab4OF7aklK1/DW3wfN0v7pOzQP12RTUzZiSk2oxG0kTZxG00q6ehm6 X-Received: by 2002:a50:fb1a:: with SMTP id d26mr73096802edq.101.1609804942580; Mon, 04 Jan 2021 16:02:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609804942; cv=none; d=google.com; s=arc-20160816; b=dmf7YLToyD7BHC60/FNcq6/TIIL9qeplKwXorrYHvuTjCx0P43o5R7rku/FVnnKRh0 /5pUhzcX69cD4K4CN3OrDn19njIMIJQGDgeZPfmnoJu1LHa4ktxUreE0H+Hzs7YoHA+m 4euEFFAdBOvi+T9rlqjSHL5lRVBA7VVxyyfXEaxXYhGSAycTHdkutgHShW5fSImh0yUq twZ54Ugen8PmkcHZBtaF1SckH5tfg6cUkVQsCcJtBFAgHyMS6VWVhmGTEnXYDyaIDFC2 rCuNtknqZy6/nmdg8V4J6tAXvzkJA6IveJfwREpUBRQWVudC+EEBs1l7G/ULlpp4sMhA +tcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SHHD7A8wdQkjDrmLnfifNyaav1sJb/fGB9kAgRaskXg=; b=uSlU4wIziHyu4g7ujtsVvkctohe1bE7Ae+WQmpyRleuMijC7SBoSw2u7TAs3ehalAE yRq4hH6F+Dctp50t10OdINb58tVw9ocp7dWPGLuJP0wrxjyOCXKgB0qnuVZm40V52HX7 MIIHRgdchTtB020U2DSQHl08cklkyDoUDSjvNnFLyKH+O9oKvwBxkVW9IOhGEMql8UQ9 XJcdAXm3NSfGB2SUqCf096fXDHUSGavrOIZMWd2Qha/sHyKBJM9iNdN729VVMFSw1l2N eRv+7YGFC4xep5AhdSaGiwjilyV5I7ksbrjeTwcL8IvrPsME0UjU84h2ctRqRlkEqmQy iVYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OvaT9uMW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz19si5642343ejb.560.2021.01.04.16.01.59; Mon, 04 Jan 2021 16:02:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OvaT9uMW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727836AbhADX6w (ORCPT + 99 others); Mon, 4 Jan 2021 18:58:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbhADX6v (ORCPT ); Mon, 4 Jan 2021 18:58:51 -0500 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB386C061794; Mon, 4 Jan 2021 15:58:10 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id f6so27605143ybq.13; Mon, 04 Jan 2021 15:58:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SHHD7A8wdQkjDrmLnfifNyaav1sJb/fGB9kAgRaskXg=; b=OvaT9uMWLRmWGV1j/mZZyxM8SNQ1oUQ9MIzivoKEM0WaCvgG0i0dcHjxGyOIVkqwwh af+s1rIuLcR0p7GaaiyYd9bp5w5lSFUqOUbzvfUOU1vIDhcG4bcUqNdCIHHLl5I4Jy0X cVNZicTXpnG8lexF6wxembCFSg8Wps/26N5PVojs75lVDshmIHkcArIr6I17+FHJaBRC yZEqd3jGYBVV0J2Y37wesYXgtSeU0jmLdJemnKfek513vUxTbTK4L38s21te1NGavmkU omCnIqoYZs5/QIaccMDXSDzRKqsnBxkLOO1QuV0bdB4a67MAfxddNgY6AUE5T8HJ2Pho 166w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SHHD7A8wdQkjDrmLnfifNyaav1sJb/fGB9kAgRaskXg=; b=HpVk7aHBL4zTDGxzxnMLMQZ/MkefawHVDAtoIm9fbRBzqOZQ7KMKuSt+3p++RpTe4u 40p7c2GUj7xQv8ai7hY2VdPrQuRi2h64SePgkyFPa5LKniJ+DwnRAtpLovMbBN+I3WN6 GBkQxN+x6osGwslS2irNsU2eePKWrYgwkKQ/vzdSJ62VuAvZV2X7q6DSfDLHYPmi5lSI gIMR1gBSRyu/EjERcK0hUAPKA0v3A7Rtkcjd52F9IJPjR7kYIxP7X3XHnrCAF28l8YvW SLuDtnMpr6nFt+X/gObgr/Fjwq/9QtA+BtRXX4bjhk0RS/CbK365qQB2xJGEiwJKUfWg D6iQ== X-Gm-Message-State: AOAM530HTS7/RFOduvZo9w8p2f4FidfDLI7ASySMXOWW/keFuOyhP3t0 nR3V7A3u/LCLu73ikuUwSraEk54przkrYiHCzjDiE5As X-Received: by 2002:a25:c7c6:: with SMTP id w189mr107283250ybe.403.1609793690747; Mon, 04 Jan 2021 12:54:50 -0800 (PST) MIME-Version: 1.0 References: <20201229151352.6hzmjvu3qh6p2qgg@e107158-lin> <20201229173401.GH450923@krava> <20201229232835.cbyfmja3bu3lx7we@e107158-lin> <20201230090333.GA577428@krava> <20201230132759.GB577428@krava> <20210102230654.GA732432@krava> In-Reply-To: <20210102230654.GA732432@krava> From: Andrii Nakryiko Date: Mon, 4 Jan 2021 12:54:39 -0800 Message-ID: Subject: Re: BTFIDS: FAILED unresolved symbol udp6_sock To: Jiri Olsa Cc: Qais Yousef , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jiri Olsa , Networking , bpf , open list , Arnaldo Carvalho de Melo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 2, 2021 at 3:07 PM Jiri Olsa wrote: > > On Sat, Jan 02, 2021 at 02:25:34PM -0800, Andrii Nakryiko wrote: > > SNIP > > > > > > > so your .config has > > > CONFIG_CRYPTO_DEV_BCM_SPU=y > > > > > > and that defines 'struct device_private' which > > > clashes with the same struct defined in drivers/base/base.h > > > > > > so several networking structs will be doubled, like net_device: > > > > > > $ bpftool btf dump file ../vmlinux.config | grep net_device\' | grep STRUCT > > > [2731] STRUCT 'net_device' size=2240 vlen=133 > > > [113981] STRUCT 'net_device' size=2240 vlen=133 > > > > > > each is using different 'struct device_private' when it's unwinded > > > > > > and that will confuse BTFIDS logic, becase we have multiple structs > > > with the same name, and we can't be sure which one to pick > > > > > > perhaps we should check on this in pahole and warn earlier with > > > better error message.. I'll check, but I'm not sure if pahole can > > > survive another hastab ;-) > > > > > > Andrii, any ideas on this? ;-) > > > > It's both unavoidable and correct from the C type system's > > perspective, so there is nothing for pahole to warn about. We used to > > have (for a long time) a similar clash with two completely different > > ring_buffer structs. Eventually they just got renamed to avoid > > duplication of related structs (task_struct and tons of other). But > > both BTF dedup and CO-RE relocation algorithms are designed to handle > > this correctly, ... > > AFAIU it's all correctly dedulicated, but still all structs that > contain (at some point) 'struct device_private' will appear twice > in BTF data.. each with different 'struct device_private' it's correct from the type system perspective, right. Those two duplicates of struct device_private are parts of two different hierarchies of types. However inconvenient it is, C allows it, unfortunately :( > > > ... so perhaps BTFIDS should be able to handle this as > > well? > > hm, BTFIDS sees BTF data with two same struct names and has no > way to tell which one to use > > unless we have some annotation data for BTF types I don't > see a way to handle this correctly.. but I think we can > detect this directly in BTFIDS and print more accurate error > message > > as long as we dont see this on daily basis, I think that better > error message + following struct rename is good solution Perhaps warning and handling this gracefully is a bit better way to handle this. Renaming is definitely good, but shouldn't block the kernel build process. I don't remember the exact details for why duplicate struct would cause troubles for resolve_btfids, but maybe just picking the struct with minimal ID (out of 2+ duplicates) would be ok in practice most of the time. In any case, that's what most users (including libbpf) will do, when searching for the type by name. > > > > > > > > > easy fix is the patch below that renames the bcm's structs, > > > it makes the kernel to compile.. but of course the new name > > > is probably wrong and we should push this through that code > > > authors > > > > In this case, I think renaming generic device_private name is a good > > thing regardless. > > ok, I'll send the change > great, thanks > jirka >