From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 608103845183 for ; Sat, 26 Nov 2022 01:37:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 608103845183 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x232.google.com with SMTP id r76so6045277oie.13 for ; Fri, 25 Nov 2022 17:37:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=hwiJEmoPnR/G8Lg8U14K8pQajI7DUbEA+F9J7Y8HJ7Q=; b=eRTdaL9/47wpjH38COnS4BKprtTELp2TvVb1WNQu8u7miATlXdKzreyz4jRFPbfQP6 iwHtDLu7CiG5GbT9WpDcbyhfjnlmmJjrpyufqquO8km+YWIYPZdnqZGWbX7mVnqPGCuI lA0Za/P0xmf0zY6TxhvPdZ1AFV7i1KJQuCYUDYCZ/ZcHlrKqH2Cwn1BMZxvPqa1bbeCV FIxd7NFSdo83Fqn8Au4eZVuKDoBg7m2JRPiCg4LDgtQ+yOKpyFbv7ErKSfbiIBbBuZCt dXJrmDtNlpbpYCr3yTItsVG2aQJkS2Vi11FKwwwO/6vyM/esvxtodwVPmF5W3sxRY1pk ksLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=hwiJEmoPnR/G8Lg8U14K8pQajI7DUbEA+F9J7Y8HJ7Q=; b=6/Em3hMXS9hD0JiFCe5pHWEez2dyGHPkI40dZif9e/Ei9Y3xhm/B3HRWx50HXRPzlj BMiWEE2wJ4kMgOhI8JOvww61tKAskWQYz6K2AacXuJQLm7JIsV+cdKr4bvMvDtFdeyaw GXOsFB1jpMAvz0k+RYLGVTEhpAfeV/o/XPGgaKGx9S/Mf846DSmstMVjJ3AvxYnZA6/Q lf5pdmkPn8y95JCvmg/OiteEQGfIw7CDLlQ1WK84bbQPu28c/HxLh0iSSil5Ua1eL8qe LbVk9WpfsrruJ6mb++Tukd+qT7Q5umrahLvJrA+FIDrPzy5LlT2g5al2ZKL5b+EP7CbB YYJA== X-Gm-Message-State: ANoB5pnqrZZzZCEa1UMABD4g1VZ4vtesw/9AwPlCworX5L8FNasbQ+Kl ubbyOdbf5FBSpbAHs0C2Kxg59w== X-Google-Smtp-Source: AA0mqf4/usBr2Kixsv9eTzUfjmJ4lFzIGQnNg27fTNmfMC6jCKnha40gmv2LvZAQb5/7sGfOr/mSGw== X-Received: by 2002:a05:6808:8c9:b0:35a:cf84:d837 with SMTP id k9-20020a05680808c900b0035acf84d837mr19422348oij.270.1669426643737; Fri, 25 Nov 2022 17:37:23 -0800 (PST) Received: from localhost ([2804:14d:7e39:8470:41ee:c7fc:c991:eee6]) by smtp.gmail.com with ESMTPSA id cd18-20020a056830621200b0063696cbb6bdsm2263468otb.62.2022.11.25.17.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 17:37:23 -0800 (PST) References: <20220908064151.3959930-1-thiago.bauermann@linaro.org> <20220908064151.3959930-3-thiago.bauermann@linaro.org> <07552f1c-85bf-0a09-0656-15790248c036@arm.com> User-agent: mu4e 1.8.9; emacs 28.1 From: Thiago Jung Bauermann To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/8] gdbserver: Add thread parameter to linux_get_auxv and linux_get_hwcap In-reply-to: <07552f1c-85bf-0a09-0656-15790248c036@arm.com> Date: Sat, 26 Nov 2022 01:37:21 +0000 Message-ID: <8735a6a432.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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: Hello Luis, Thank you for your review. Luis Machado writes: > On 9/8/22 07:41, Thiago Jung Bauermann via Gdb-patches wrote: >> This patch doesn't change gdbserver behaviour, but after later changes a= re >> made it avoids a null pointer dereference when HWCAP needs to be obtained >> for a specific process while current_thread is nullptr. >> Fixing linux_read_auxv, linux_get_hwcap and linux_get_hwcap2 to take a >> thread_info parameter seems more correct than setting current_thread in = one >> particular code path. >> Changes are propagated to allow passing the thread parameter through the >> call chain. > > I suppose the effects will only be known when later patches are > applied. But the auxv data is per-process, right? AFAIK yes. > It sounds a bit strange to pass a thread for the hwcap/auxv lookup. Is > there some other reason to do that? Good point. I did it this way without thinking about it because the read_auxv methods use current_thread. I changed the patch to add an =E2=80=9Cint pid=E2=80=9D parameter instead and it worked fine. I still get= the PID from current_thread when it's not available from the calling function though. --=20 Thiago