Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2843272rdb; Tue, 12 Sep 2023 14:01:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhbVyHHeOgc+fGtbwcNCjdZgFzgUq11Pnhbl38x/6eGAMB3YNJYksgyLE7Zm9USS7voPDN X-Received: by 2002:a05:6a20:7491:b0:149:802f:28be with SMTP id p17-20020a056a20749100b00149802f28bemr620002pzd.52.1694552475831; Tue, 12 Sep 2023 14:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694552475; cv=none; d=google.com; s=arc-20160816; b=hBUwT1R4u82wNcaodmVDB/X8yl19ZCmS8F6LZzHLj/WGAYvxXf0vgGJrHSMHBpbUno gDqAEz5H+q5Hi3R7k181rEu/MEvXcltrFZxv8d95m4qpvc9lLT7ONcKZzGCQftBAQkKJ h9AS5lfgd5rgQ9qOY+MIaUEHXUO0cihjazaU7A+RPTrpwDN3tVkncI+tVNUXWUKfbZup R+x1nkPKEwgegwTj/kLjapmnqLlsh3tSM2YXbU5kfX9vu94Q1CR3kRaWWrZEafvlg6JR nzP7mqjQFBY4JmUQW8yFym7WDM0BTZa8ViaIVbm07/TTRO33akTvmyywtMoEa9Mv4Hoi iiZQ== 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=CN89uS22Fp8hqoBkQ7h2ESKNsmqtKbE4YnZMd1TJDLU=; fh=E5eWthJaRPpUbZVMYVrFjsDroWiUuNhMXYIjXQwaBTY=; b=S9b2Wut7sJdpNQ2JUCkGSLqicbKDRS9TFRWSaCN6qRGQp6I5q3CUUFQjjiPE8mnNUH pBSsoP6dXMYtGiiZgmGlLVRvuLQ16zsTIYpwOBc0DVxDe6QHiwdmTTERUqj0e6GOlGyr N8NUY5FKa5LXrHFtIz+7NYOw+b/Lt5LjSq2csZzRAzf/GUyXnIgrXeNCfoxaKB0EUrbQ GBM2BRLaTove2IL6wxhy51UXVW0c4XBKQlQ4HgXv7CwQytGL1q5D3oSu1lCHgxalcSIi Paq7SxrdmqNVQCKGOsR3fLYBYsQi5OHjbzSsz2iDt+JgTFyXHWCt072j1XDyrTKSgbmf AfUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=TPYhSXPH; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id jz14-20020a170903430e00b001b8ae69289dsi8613860plb.539.2023.09.12.14.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 14:01:15 -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=@gmail.com header.s=20221208 header.b=TPYhSXPH; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C147581AB538; Tue, 12 Sep 2023 07:18:46 -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 S235845AbjILOSp (ORCPT + 99 others); Tue, 12 Sep 2023 10:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235824AbjILOSm (ORCPT ); Tue, 12 Sep 2023 10:18:42 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F89C10D; Tue, 12 Sep 2023 07:18:37 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3a8614fe8c4so4245928b6e.1; Tue, 12 Sep 2023 07:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694528316; x=1695133116; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CN89uS22Fp8hqoBkQ7h2ESKNsmqtKbE4YnZMd1TJDLU=; b=TPYhSXPHVSMEbhY3bGAt1K3FmKQWxmapOKswoQseqHSPw/68+nY4ZIu2utju85s5K7 4Dh58we7ib4sngjeSCERl78VGMHsjLOjjzyG3JFCiLnQJEX8+OHvgJVkJPnk1mD3EFvn grJC6El8QXQNWD3z+CnGPgLrTlAbdwvJJaTefzKNkHYQOhJrJqaGAmvAYrtAvhy6Tp6x Fgh7xPOyvAkcNdNJFjAgZ4ZcBu1sXY8viuh6zleK7T0nVdAqhwynwTrpMpfXfKO5L2Z1 /kJ+LZiKtP5+COnVZkQtG+qestVUuNIkkgdjxV/stILoIkb9OyEcDdcO3O8jj8GM+UYj oi6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694528316; x=1695133116; h=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=CN89uS22Fp8hqoBkQ7h2ESKNsmqtKbE4YnZMd1TJDLU=; b=hJ636szhOk+tjV22c8FQDKv8sdjPYm7RTW9gzU1d7sFquq+dTG0aP2yZ8xpUpKNJAO t1F5hF2HQ3k/6jEWV5H/CcETBSfeB+IxR6KACkLujWTE6a0UA+kYFju0twslcerg09If 4D3xj++OfWcMffjmefp1NTQ2A7fSEtlB/xrP7sQqJqHHK7iwwepEYOA9cWd0WhwMgDyt VHFCVvJYkxOZRIH4JHdJ1nPTOkJ+Yi9yB4nnNFd6iNlFtuR6EJ2Bvnl6Hq93sVIyT8up oj5AM7epiwIYjpgHfpGqWxD57hI5cfAzVdD5tfChVfx3ELvPeuU866NQRHN82vA7n1Ho vOFQ== X-Gm-Message-State: AOJu0YzCEm/wpHMsrmCQK8HG0bfaI2t8rVc61tTjeA3IHHFXvkuCYbUs f5ocOBXcnnpOztWk0QuKiqyyPVkxCJLQO2NFY84= X-Received: by 2002:a05:6870:1f0d:b0:1d5:e498:35de with SMTP id pd13-20020a0568701f0d00b001d5e49835demr3247004oab.26.1694528316223; Tue, 12 Sep 2023 07:18:36 -0700 (PDT) MIME-Version: 1.0 References: <20230828080423.3539686-1-alessandro.carminati@gmail.com> In-Reply-To: From: Alessandro Carminati Date: Tue, 12 Sep 2023 16:18:00 +0200 Message-ID: Subject: Re: [PATCH v3] scripts/link-vmlinux.sh: Add alias to duplicate symbols for kallsyms To: Alexander Lobakin Cc: Masami Hiramatsu , Steven Rostedt , Daniel Bristot de Oliveira , Josh Poimboeuf , Masahiro Yamada , Luis Chamberlain , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Nick Alcock , Kris Van Hees , Eugene Loh , Francis Laniel , Viktor Malik , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, live-patching@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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]); Tue, 12 Sep 2023 07:18:46 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 Hello Alexander, Thank you for your mail. Il giorno lun 11 set 2023 alle ore 16:26 Alexander Lobakin ha scritto: > > From: Alessandro Carminati (Red Hat) > Date: Mon, 28 Aug 2023 08:04:23 +0000 > > > From: Alessandro Carminati > > > > It is not uncommon for drivers or modules related to similar peripherals > > to have symbols with the exact same name. > > [...] > > > Changes from v2: > > - Alias tags are created by querying DWARF information from the vmlinux. > > - The filename + line number is normalized and appended to the original name. > > - The tag begins with '@' to indicate the symbol source. > > - Not a change, but worth mentioning, since the alias is added to the existing > > list, the old duplicated name is preserved, and the livepatch way of dealing > > with duplicates is maintained. > > - Acknowledging the existence of scenarios where inlined functions declared in > > header files may result in multiple copies due to compiler behavior, though > > it is not actionable as it does not pose an operational issue. > > - Highlighting a single exception where the same name refers to different > > functions: the case of "compat_binfmt_elf.c," which directly includes > > "binfmt_elf.c" producing identical function copies in two separate > > modules. > > Oh, I thought you managed to handle this in v3 since you didn't reply in > the previous thread... I want to thank you for this observation because it gives me the chance to discuss this topic. It is evident that the corner case in question is inherently challenging to address using the addr2line approach. Attempting to conceal this limitation would be counterproductive. compat_binfmt_elf.c includes directly binfmt_elf.c, addr2line can't help but report all functions and data declared in that file, coming from that file. compat_binfmt_elf.c is just a bunch of macro definitions that rename a few symbols and define some items used in macro-defined compilation in binfmt_elf.c. Looking at the functions, only two of the functions defined by compat_binfmt_elf.c are binary different from their counterpart in binfmt_elf.c. These differences, while present, are indeed minimal, but this fact not relevant to this discussion. My position is that, rather than producing a more complicated pipeline to handle this corner case, it is better to fix it. Before reading your message, I was about to send the v4, but now I'd prefer to hear the others' opinions on this matter before taking any future action. > > > > > sample from new v3 > > > > ~ # cat /proc/kallsyms | grep gic_mask_irq > > ffffd0b03c04dae4 t gic_mask_irq > > ffffd0b03c04dae4 t gic_mask_irq@_drivers_irqchip_irq-gic_c_167 > > ffffd0b03c050960 t gic_mask_irq > > ffffd0b03c050960 t gic_mask_irq@_drivers_irqchip_irq-gic-v3_c_404 > > BTW, why normalize them? Why not just > > gic_mask_irq@drivers/irqchip/... > > Aaaaand why line number? Line numbers break reproducible builds and also > would make it harder to refer to a particular symbol by its path and > name since we also have to pass its line number which may change once > you add a debug print there, for example. > OTOH there can't be 2 symbols with the same name within one file, so > just path + name would be enough. Or not? Regarding the use of full file paths and line numbers for symbol decoration, it indeed provides the highest level of uniqueness for each symbol. However, I understand your point that this level of detail might be more than necessary. This approach was implemented in response to a specific request expressed in the live-patching list, and I wanted to ensure we met those requirements. I am open to revisiting this aspect, and I am willing to accommodate changes based on feedback. If you believe that simplifying the format to just path + name would be more practical, or if you think that eliminating line numbers is a better choice to avoid potential issues while debugging builds, I'm open to considering these adjustments. Additionally, I've interpreted and implemented Francis's suggestion as making the separator a configurable option, but maybe a proper format string here, would be more appropriate. > > (sorry if some of this was already discussed previously) > > [...] > > Thanks, > Olek Thank you, Alessandro