From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2089.outbound.protection.outlook.com [40.107.6.89]) by sourceware.org (Postfix) with ESMTPS id 4AB193858D1E for ; Tue, 29 Nov 2022 08:38:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4AB193858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=INk/fAnZKp1QeG10dvE8zFc5TsPWeRudKo32gGdYHTGd1MBMTco1/+ebc/7tMLvW/r4nDfzdg3xadtAWi7mwEYCekNMhYPV6vIw6V7K4GYQTc1U58cwxL/0SiAS2CQEHlLniMpt52vaWvK7GY7xbA6YaT6dvXnpDrLIj85M8K+lKPuO3X7n7xnUVJYuKzY8W7OC4yMET80rKUhEs9wXLVHTy6qOuYs5WFsE5OjnQUdraMUBZjsaKyH9QDAN7LTO0v6HuCnPSYwM4LOiCHMkrS4qYokkFKP6YIh1/qzi2XMslLlY4wsA5EcZC+pAOVaVs4ztILjQ4KZzCaWTj1bKepQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o9dLchFfbRA+qtjcn+KBo1/pOg8E1OhAhNJGhp/hBtE=; b=gMLM7i4V+9IorDIwIfNKIaUjCe1N1fCiWj8iuaG+ZutgWLyvCjdWy6A4Cq/I8z9cYKDpvtTpLkC7lgfu3Gl157bH69yc/JSBjc5SJtR2F2IbBAtjbTRRIXaxtUnye/PlAbvDcUJuk/hmJjtwfDc4S+6hccHGHCIXQlmS+VSAcaPc/9+K2gy0XJE80BV/kj6uSUc9gb75xFDSu+UmRODXSDYSuP710v2jB1gMWlX+kPE5lSKLf9aUDGh8GsqLSlkcn9SJufRLvpkyy4kulzE2P+ibowD9Wq1bnm8Ist+O9yswm0WXEvBCU0iTXISv5C210fULioSuXMgNfVUnDcyjWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o9dLchFfbRA+qtjcn+KBo1/pOg8E1OhAhNJGhp/hBtE=; b=jr6UArP5WPN2zKn37grIdszjPjo8evOCeBBWgQXxMpM4FQKAOvWi/XKvhCydP12uwc0UexM1f3VA6+uFH2PQs96Em2qfvmnrfOdm4CW/R2CuAsjVdbhV9D07/VV8ftbFSlosYQzIlhIKpsedRaHK5l8WLNE/NX1zUXHkzO6n/lo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by PAVPR08MB9747.eurprd08.prod.outlook.com (2603:10a6:102:31e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.7; Tue, 29 Nov 2022 08:38:43 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::fe5c:b195:a2ad:b19c]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::fe5c:b195:a2ad:b19c%4]) with mapi id 15.20.5880.008; Tue, 29 Nov 2022 08:38:43 +0000 Message-ID: Date: Tue, 29 Nov 2022 08:38:40 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] gdb: relax requirement for the map_failed stap probe to be present Content-Language: en-US From: Luis Machado To: Andrew Burgess , Simon Marchi , gdb-patches@sourceware.org References: <9b1fe2f9-b4a9-17a8-1175-a1a776db1afc@simark.ca> <87y1s03a0a.fsf@redhat.com> <87sfi30zgy.fsf@redhat.com> <610ebe6b-64d0-d0c9-f9da-9e1445d53d73@arm.com> In-Reply-To: <610ebe6b-64d0-d0c9-f9da-9e1445d53d73@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO6P265CA0016.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ff::7) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|PAVPR08MB9747:EE_ X-MS-Office365-Filtering-Correlation-Id: 057e6ffb-8605-47bc-0bb3-08dad1e51f71 NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IrgDRZujIJ6jT/EtGqyBjIl6voh3nlrgRPD5G3fdNLSWOgLSYiZ2ku103uaw8jwszfEgrREQz+OgaCf1R0Yvq7dtSTao1TWr6v3szHUHFNITIVJ50M+zocPCvRQzC+saKyynIj7cGk9Kgbmh/UL+9XWrL7EGqCSb6bFxwkLoYe3dd1mdQ/Dq/T+5QoC/TDs6IrhiQXsYTPQfixVceKccsaav7mjZ7RXPmMM+emZcRhTLDnXVtN+s7q2C7ehXBTHoLzJcQVSMYFtu4nfhUkV1aDfPydvqRhv7K1uHIJFn4vGE96P6ycDp9xohLXpcPB6U+oRusal9J9O3VHMZOlH7QTytOl6rFiosi7SBHj+4l2FAMw1SfLqle7Qds1JIJ9/aNOTr6fr70lcr2OI7Fo8rsoV+emYtQwDtGZc3UmqQrcYy+/pRFgLKsea1tznPcdLrG2c0zfIjgkl7hEYara36iyahkZF2G6X57DMxy+iY+d/Tp3RDvAOBJ1tWCfR/iVouXiTXvTfRD9ArQrF8STxUPypLcO/zkqEELb85XbMPExdPtb3W7L2SyDI6yRIFRV8YdffRrwSsFAH9/o3Lw4vhJtSVR9UosrrxaqExKJZwZk3kt8Ua5dmBh881bmeGNzwnw0yMm1kuK7dq6ON47eIDsu8v76xeOXJOakvLXR1kB1CJ33sPtsfkH9SF+TdVnHTpzk3W5XcMCMgITrpnvxRng10n7Pwfbw3RVQdyroIclE+8JRWlWEN4wGUpvaQqcWU5 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB3919.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(376002)(396003)(346002)(136003)(39860400002)(451199015)(6486002)(110136005)(966005)(86362001)(478600001)(44832011)(30864003)(31696002)(38100700002)(316002)(5660300002)(41300700001)(36756003)(8676002)(8936002)(66946007)(66556008)(66476007)(186003)(2616005)(31686004)(83380400001)(53546011)(6512007)(26005)(6506007)(2906002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cmRwcXNUelJoTmNoQUNqV2hEa2VNT0thejhacGVHV3F5ZUloeTJQa0R2L3h4?= =?utf-8?B?dGJpUTdlRDFpNFcvR1JjcWxsQkgyNm9Cc3pVdzgvbHFHM1JrMlFUVnIycEg1?= =?utf-8?B?Q3J3TWJKcUNQY1hOVHhXTk1mVjFXZER3dERtczh3NmQwamM0emhOeUdBQzZn?= =?utf-8?B?dHlEYjg0czlzNDhKd3paU2pNZDNnUFJ4Q3V4aWZ0cnA0WGk4bXFjd0xYdDBR?= =?utf-8?B?b2pKSVY5WGxGSmN5RWJxVnpmNGtXMUI4RUw0b3U5aStZUUx5UnhFbWhzRl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1CS1ZWS1NRY2E0aGRIQUZGclpIM3NKL3VQZFR5SDFMTGt5?= =?utf-8?Q?36gMqZWDqv30E2ZCxVh+2JXDz?= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 057e6ffb-8605-47bc-0bb3-08dad1e51f71 X-MS-Exchange-CrossTenant-AuthSource: VI1PR08MB3919.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 08:38:43.2502 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wfB2F1qepiWF46r5d+J+I/zvW+MsUvkoyyd+Bwa+qp3VJNd9ER0CFgIMx69aB9scG8Lw3n5ZmucyUimoUplmeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9747 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,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 11/29/22 08:27, Luis Machado wrote: > Hi Andrew, > > This seems to have broken armhf on Ubuntu 22.04. > > https://builder.sourceware.org/buildbot/#/builders/169/builds/1163 > I haven't investigated this. I only spotted it in the sourceware buildbot page. But I'd guess it is something to do with thumb mode detection early in the startup. Ubuntu has moved to not stripping ld.so for armhf because the probe mechanism is not capable of conveying the thumb mode information, so gdb has to rely on symbols instead. If the changes have touched this fragile area, it may have broken the delicate balance. > On 11/28/22 17:18, Andrew Burgess via Gdb-patches wrote: >> >> Thanks you all for your review feedback. >> >> I've now pushed this version of the patch (inc Pedro's suggested typo >> fix). >> >> Thanks, >> Andrew >> >> >> Andrew Burgess writes: >> >>> Simon Marchi writes: >>> >>>> On 11/22/22 10:09, 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; >>>>>         /* Ensure at least one probe for the current name was found.  */ >>>>> >>>>> base-commit: 84f9fbe90e5429adb9dee68f04f44c92fa9e2345 >>>>> -- >>>>> 2.25.4 >>>> >>>> Hi, >>>> >>>> I looked at this separately, and this was one of the fixes I considered. >>>> >>>> Another option was to make GDB not give up on the probes interface if >>>> failing to look up a probe whose action is DO_NOTHING.  Probes with that >>>> action are not used by GDB for solib bookkeeping, but can be used to >>>> stop on solib events, with "set stop-on-solib-events".  I was just >>>> worried if there was some cases where a probe would be missing, but the >>>> corresponding event could be caught if using the original interface.  In >>>> that case, using the probes interface would be a regression.  But it's >>>> probably not worth wondering about.  If that happens it's just a bug >>>> that needs to be fixed.  In the case we are looking at, if the >>>> map_failed probe gets optimized out, then surely the corresponding call >>>> to the r_brk function would also be optimized out. >>> >>> I also considered just ignoring any probe was (a) missing, and (b) had a >>> DO_NOTHING action.  The reason I didn't post this patch was because, at >>> the time, my thinking was: if we don't care about any probe with a >>> DO_NOTHING action, why even look for those probes, why not just remove >>> them from the list? >>> >>> I think you've (partially) convinced me that the user might be >>> interested in seeing a stop at these probes even if GDB's action is >>> DO_NOTHING. >>> >>> I say partially above because GDB doesn't really do anything to tell the >>> user which probe we stopped at, e.g. was is "init_start", "map_start", >>> "map_failed", etc.  The user might be able to figure it out from the >>> backtrace, but I still think it's not going to be trivial in all cases, >>> e.g. "map_start" and "map_failed" are both located in the same function, >>> so I think the user would need to lookup the probe address in the ELF, >>> then compare that to the stop address.  Not impossible, but, I suspect, >>> the complexity is an indication that users are not doing this much. >>> Thus, I suspect, in reality, nobody really cares about the DO_NOTHING >>> probes. >>> >>> However, I think there is enough of a justification there for keeping >>> the probes in the list, and just skipping any DO_NOTHING probes that >>> don't exist. >>> >>> Below then, is an alternative patch.  I don't have a strong preference >>> between this one, and the original[1], but I thought I'd post this for >>> discussion.  If this is preferred then I can just merge this. >>> >>> [1] I'll also post an update to the original patch shortly that >>> addresses Lancelot's feedback. >>> >>> Thanks, >>> Andrew >>> >>> --- >>> >>> commit 11be1f25f446e68c23d0709cde46e32ff24b7eb9 >>> Author: Andrew Burgess >>> Date:   Tue Nov 22 12:45:56 2022 +0000 >>> >>>      gdb: relax requirement for the map_failed stap probe to be present >>>      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.  This is fine, the >>>      action associated with this probe inside GDB is DO_NOTHING, this means >>>      the probe isn't actually required in order for GDB to correctly detect >>>      the loading of shared libraries. >>>      In this commit I propose changing the rules so that any probe whose >>>      action is DO_NOTHING, is optional. >>>      There is one possible downside to this change, and that concerns 'set >>>      stop-on-solib-events on'.  If a probe is removed from glibc, but the >>>      old style breakpoint based mechanism is still in place within glibc >>>      for that same event, then GDB will stop when using the old style >>>      non-probe based mechanism, but not when using the probes based >>>      mechanism. >>>      For the map_failed case this is not a problem, both the map_failed >>>      probe, and the call to the old style breakpoint location were >>>      optimised out, and so neither event (probes based, or breakpoint >>>      based) will trigger.  This would only become an issue if glibc removed >>>      a probe, but left the breakpoint in place (this would almost certainly >>>      be a bug in glibc). >>>      For now, I'm proposing that we just don't worry about this.  Because >>>      some probes have actions that are not DO_NOTHING, then we know the >>>      user will always seem _some_ stops when a shared library is >>>      loaded/unloaded, and (I'm guessing), in most cases, that's all they >>>      care about.  I figure when someone complains then we can figure out >>>      what the right solution is then. >>>      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. >>> >>> diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c >>> index 6acaf87960b..10e446af908 100644 >>> --- a/gdb/solib-svr4.c >>> +++ b/gdb/solib-svr4.c >>> @@ -2205,15 +2205,34 @@ 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")) >>> -    continue; >>> - >>>         /* Ensure at least one probe for the current name was found.  */ >>>         if (probes[i].empty ()) >>> -    return false; >>> +    { >>> +      /* 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, and the compiler optimized >>> +         the probe away.  In this case the probe name doesn't have the >>> +         "rtld_" prefix. >>> + >>> +         To handle this, and give GDB as much flexibility as possible, >>> +         we make the rule that, if a probe isn't required for the >>> +         correct operation of GDB (i.e. it's action is DO_NOTHING), >>> +         then we will still use the probes interface, even if that >>> +         probe is missing. >>> + >>> +         The only (possible) downside of this is that, if the user has >>> +         'set stop-on-solib-events on' in effect, then they might get >>> +         fewer events using the probes interface than with the classic >>> +         non-probes interface.  */ >>> +      if (prove_info[i].action == DO_NOTHING) >>> +        continue; >>> +      else >>> +        return false; >>> +    } >>>         /* Ensure probe arguments can be evaluated.  */ >>>         for (probe *p : probes[i]) >> >