From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 11D4E385842A for ; Tue, 22 Nov 2022 15:34:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 11D4E385842A Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com Received: from ubuntu.lan (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id BD8C880018; Tue, 22 Nov 2022 15:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lancelotsix.com; s=2021; t=1669131295; bh=BqiZYrTrTj6Z26879QWG7Bq+m797HRsffjS2RQyKgFE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NqKtwKlov//jSVgqIGLbbjar44KSyKhWwR9h+KCbbDBv2OOpbhHqH10N5i1+PFfh9 lASaF2htz7hkyaxAYmDRLkukPyL5Rwfp1smHUNPDRk1E3aYWL9pYWC6cjJbW7Vwov9 uu89+x6SNwXA7SGB1ucBzP7AukMtbkQ68ihdZWfroEE7+k79gfnlMC7wZaYjl7+Q/u zP6Upx7ZvbnGuW6y/5jiEEZRLSgOzZ9/uXoJj2WJ8HMtWtfdL/rf6ILF4KJrN/wqra ox1GYJDiQ1VYMDmwEZIRg6qY24qMDBEaIH6WE0qtgHv4NyHtpE+e1Umx8DgFjmIal6 VZHYbL/pynyNQ== Date: Tue, 22 Nov 2022 15:33:41 +0000 From: Lancelot SIX To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: relax requirement for the map_failed stap probe to be present Message-ID: <20221122153341.oegu3r7v4nwfukqi@ubuntu.lan> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Tue, 22 Nov 2022 15:34:55 +0000 (UTC) X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,TXREP 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: On Tue, Nov 22, 2022 at 03:09:40PM +0000, Andrew Burgess via Gdb-patches wrote: > From glibc 2.35 and later, the "map_failed" stap probe is no longer > included in glibc. The removal of the probe looks like an accident, > but it was caused by a glibc commit which meant that the "map_failed" > probe could no longer be reached; the compiler than helpfully > optimised out the probe. > > In GDB, in solib-svr4.c, we have a list of probes that we look for > related to the shared library loading detection. If any of these > probes are missing then GDB will fall back to the non-probe based > mechanism for detecting shared library loading. The "map_failed" > probe is include in the list of required probes. > > This means that on glibc 2.35 (or later) systems, GDB is going to > always fall back to the non-probes based mechanism for detecting > shared library loading. > > I raised a glibc bug to discuss this issue: > > https://sourceware.org/bugzilla/show_bug.cgi?id=29818 > > But, whatever the ultimate decision from the glibc team, given there > are version of glibc in the wild without the "map_failed" probe, we > probably should update GDB to handle this situation. > > The "map_failed" probe is already a little strange, very early > versions of glibc didn't include this probe, so, in some cases, if > this probe is missing GDB is happy to ignore it. In this commit I > just expand this logic to make the "map_failed" probe fully optional. > > With this commit in place, then, when using a glibc 2.35 or later > system, GDB will once again use the stap probes for shared library > detection. > --- > gdb/solib-svr4.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c > index 6acaf87960b..87cd06f251a 100644 > --- a/gdb/solib-svr4.c > +++ b/gdb/solib-svr4.c > @@ -2205,10 +2205,15 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info, > > probes[i] = find_probes_in_objfile (os->objfile, "rtld", name); > > - /* The "map_failed" probe did not exist in early > - versions of the probes code in which the probes' > - names were prefixed with "rtld_". */ > - if (with_prefix && streq (name, "rtld_map_failed")) > + /* The "map_failed" probe did not exist in early versions of the > + probes code in which the probes' names were prefixed with > + "rtld_". > + > + Additionally, the "map_failed" probe was accidentally removed > + from glibc 2.35 and later, when changes in glibc meant the probe > + could no longer be reached. In this case the probe name doesn't > + have the "rtld_" prefix. */ > + if (streq (probe_info[i].name, "map_failed")) > continue; Hi, Wouldn't this just disable the "map_failed" probe for everyone, even if it is available for the current glibc? Should this become: if (streq (probe_info[i].name, "map_failed") && probes[i].empty ()) continue to only ignore this probe if it is missing? Best, Lancelot. > > /* Ensure at least one probe for the current name was found. */ > > base-commit: 84f9fbe90e5429adb9dee68f04f44c92fa9e2345 > -- > 2.25.4 >