From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AC4F43858D39 for ; Mon, 20 Nov 2023 16:05:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC4F43858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AC4F43858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700496324; cv=none; b=YBdA20Z9G7X2SYPyU0Nx4hP8F2zH1SQ1HMZMV9EagUHAHmHHikNM0l+Jv97zVzJ34kKWz3OfpCHdSBf/s4xhALOsyfoPLFFQ9Z27c2LJ0N8Ws3K8nH9FUYc2gonB9yMTj6wAXqGCrmv6AmoFhX4aEM0pEZzOvm8byPc0flYfmCk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700496324; c=relaxed/simple; bh=FX9ZJnAhrICPKWxjQ6sGeMvVpSvZp2pdHZuE4U6Ozb0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=X2PXk3OElMdpfKN/jxOPqSq4Jj6yRCTLB1Fg6ndTS5nkoh3urp+fELLIrtiDu6pfEna8oOgXQW+I8Z+yHXlTJGuS267oQ7cC+gkd+S7h4lTMqmiakkrKTAc2vQp9/TmGNkr4xeyO8/qkltm2yhKfTVD9/wZ0fl+OGKztCfj2Xwk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700496323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ntDX5y8EbBpnSA1byxk3jPnmAAn4WATzdHG9QhT3G3c=; b=PjXawsyPil/xS6t8nmBHqJb3z33P3O0D+43yJsek/7fxd83+BRSJHYmJyLeBFp1pMszLAA dqOdD8s/YF6SeYlJyjthEwSywmh2nO7vaNgZn7rD8nIrs0y9zDcBrsoMzRHba/+5BrMnLl u75qb8CKnGFLL/NeN4SCW2gJ4Nyb6mk= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-iXz_nmoCOri2OgswsNwFZA-1; Mon, 20 Nov 2023 11:05:21 -0500 X-MC-Unique: iXz_nmoCOri2OgswsNwFZA-1 Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-28515f4cd74so2202859a91.3 for ; Mon, 20 Nov 2023 08:05:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700496321; x=1701101121; 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=ntDX5y8EbBpnSA1byxk3jPnmAAn4WATzdHG9QhT3G3c=; b=BFVv6AYHc+Svss0NBSh3If1ZFn9ixpEvj/kvGahQVA8Ad3Ru6vogIUAori2K1tAEeb sRq7xgq222g/eR9pmXSXzpMMF7hrAy5XFpcsTray+g3aMsQjdyzGwswFDsN3bMUamm7R 6Ya947ucsUwnCbzlQE3Ov4JTWsbMDfYwk7rX7VUQqqxnfF/2uvBtFpzc3j99nCPZYroc Dt3kYgusfJvC/VQHjjt3V/+kNHT8PpAuW1slyvQ3YOt3FaTfwk+jJcRakHPDm6PUECMh u2aTJYGjQxPNEzy1NkQQYotUFo1p4puTEMf7URqAjw3LISqNJU6NIHfcHRBbQyNQCPUg y4dg== X-Gm-Message-State: AOJu0YzdgCSZuA2sfEqV/GYXJqnZSOG79/jC/CgBzD5UtOfEVxb5vgng 0xoag0fuIsyd4QHXO1M0WlPvVrAfd0VO6xBDshk9THk3sPYMlxLweAQYQwvzLLjDnm8WFP55pc8 rXgdz2HZbdWFmGgDP/67mr8SvgvTBHaWeQw== X-Received: by 2002:a17:90b:1e0f:b0:281:691:e58c with SMTP id pg15-20020a17090b1e0f00b002810691e58cmr5956698pjb.37.1700496320816; Mon, 20 Nov 2023 08:05:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHC5aV/8vYfVYGXIJYKM3YhqiX+DBATJB4eJVU9FCaPR8+SsCEXfTE/R32yV6g7t42mS7oFqkV+mNSf9wsOUb8= X-Received: by 2002:a17:90b:1e0f:b0:281:691:e58c with SMTP id pg15-20020a17090b1e0f00b002810691e58cmr5956670pjb.37.1700496320476; Mon, 20 Nov 2023 08:05:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Aaron Merey Date: Mon, 20 Nov 2023 11:05:09 -0500 Message-ID: Subject: Re: [PATCH] PR29997: Fix the symbol aliases search failure when symbol version is missing To: Di Chen Cc: systemtap@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Di, Thanks for working on this. On Sun, Nov 5, 2023 at 12:00=E2=80=AFAM Di Chen via Systemtap wrote: > > From 9273dc95658b109f048e4ec9b0fcde96e34f3419 Mon Sep 17 00:00:00 2001 > From: Di Chen > Date: Sun, 5 Nov 2023 11:23:50 +0800 > Subject: [PATCH] PR29997: Fix the symbol aliases search failure when symb= ol > version is missing > > After calling module_info::update_symtab, function aliases will be > populated. Then the updated symtab will be used for symbol searching. > > For the _IO_new_fopen familty with the aliases: > > $ eu-readelf -s /lib64/libc.so.6 | grep 0000000000077440 > 247: 0000000000077440 14 FUNC WEAK DEFAULT 16 fopen64@ > @GLIBC_2.2.5 > 1014: 0000000000077440 14 FUNC GLOBAL DEFAULT 16 fopen@ > @GLIBC_2.2.5 > 1028: 0000000000077440 14 FUNC GLOBAL DEFAULT 16 _IO_fope= n@ > @GLIBC_2.2.5 > 1556: 0000000000077440 14 FUNC LOCAL DEFAULT 16 _IO_fope= n64 > 3471: 0000000000077440 14 FUNC LOCAL DEFAULT 16 __new_fo= pen > 4765: 0000000000077440 14 FUNC LOCAL DEFAULT 16 > _IO_new_fopen > 5110: 0000000000077440 14 FUNC WEAK DEFAULT 16 fopen64 > 7198: 0000000000077440 14 FUNC GLOBAL DEFAULT 16 fopen@ > @GLIBC_2.2.5 > 7433: 0000000000077440 14 FUNC GLOBAL DEFAULT 16 _IO_fope= n@ > @GLIBC_2.2.5 > > a) fopen@@GLIBC_2.2.5 exists in the updated symtab > b) fopen does not exist in the updated symtab > > This PR is to add a version info padding when symbol cannot be found in > the updated symtab. > > Signed-off-by: Di Chen > --- > dwflpp.cxx | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/dwflpp.cxx b/dwflpp.cxx > index a4f66440f..22e1479c9 100644 > --- a/dwflpp.cxx > +++ b/dwflpp.cxx > @@ -1052,6 +1052,15 @@ dwflpp::iterate_over_functions(int > (*callback)(Dwarf_Die*, void*), > } > > auto range =3D v->equal_range(function); > + // version info padding if the symbol is not found > + if (range.first =3D=3D range.second) > + { > + std::string function_with_ver =3D function + "@"; > + for (auto it =3D v->begin(); it !=3D v->end(); ++it) > + if (it->first.find(function_with_ver) =3D=3D 0) > + function_with_ver =3D it->first; > + range =3D v->equal_range(function_with_ver); > + } This fixes the bug for function names without wildcards. However the bug can still be reproduced using function names with wildcards. For example the following command incorrectly returns no results: $ stap -L 'process("/lib64/libc.so.6").function("fo*en")' We'll need additional '@' handling in the section of dwflpp::iterate_over_functions that matches wildcards. > if (range.first !=3D range.second) > { > for (auto it =3D range.first; it !=3D range.second; ++it) > @@ -1138,6 +1147,15 @@ dwflpp::iterate_single_function(int > (*callback)(Dwarf_Die*, void*), > } > > auto range =3D v->equal_range(function); > + // version info padding if the symbol is not found > + if (range.first =3D=3D range.second) > + { > + std::string function_with_ver =3D function + "@"; > + for (auto it =3D v->begin(); it !=3D v->end(); ++it) > + if (it->first.find(function_with_ver) =3D=3D 0) > + function_with_ver =3D it->first; > + range =3D v->equal_range(function_with_ver); > + } > if (range.first !=3D range.second) > { > for (auto it =3D range.first; it !=3D range.second; ++it) > -- > 2.41.0 Aaron