From: Simon Marchi <simark@simark.ca>
To: Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
gdb-patches@sourceware.org
Cc: Luis Machado <luis.machado@arm.com>
Subject: Re: [PATCH v2 2/6] gdbserver: Add PID parameter to linux_get_auxv and linux_get_hwcap
Date: Mon, 28 Nov 2022 10:07:32 -0500 [thread overview]
Message-ID: <43979fb5-a40b-9dd8-f4e6-bde0a598e505@simark.ca> (raw)
In-Reply-To: <20221126020452.1686509-3-thiago.bauermann@linaro.org>
On 11/25/22 21:04, Thiago Jung Bauermann via Gdb-patches wrote:
> This patch doesn't change gdbserver behaviour, but after later changes are
> 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 PID
> parameter seems more correct than setting current_thread in one particular
> code path.
>
> Changes are propagated to allow passing the new parameter through the call
> chain.
Thanks, this is ok, with the following nits fixed:
Approved-By: Simon Marchi <simon.marchi@efficios.com>
... unless Luis is strongly against it.
> ---
> gdbserver/linux-aarch64-low.cc | 7 ++++---
> gdbserver/linux-arm-low.cc | 2 +-
> gdbserver/linux-low.cc | 18 +++++++++---------
> gdbserver/linux-low.h | 9 ++++-----
> gdbserver/linux-ppc-low.cc | 6 +++---
> gdbserver/linux-s390-low.cc | 2 +-
> gdbserver/netbsd-low.cc | 4 +---
> gdbserver/netbsd-low.h | 2 +-
> gdbserver/server.cc | 2 +-
> gdbserver/target.cc | 4 ++--
> gdbserver/target.h | 2 +-
> 11 files changed, 28 insertions(+), 30 deletions(-)
>
> diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
> index db5086962612..a6ed68f93029 100644
> --- a/gdbserver/linux-aarch64-low.cc
> +++ b/gdbserver/linux-aarch64-low.cc
> @@ -823,12 +823,13 @@ aarch64_target::low_arch_setup ()
> if (is_elf64)
> {
> struct aarch64_features features;
> + int pid = pid_of (current_thread);
>
> features.vq = aarch64_sve_get_vq (tid);
> /* A-profile PAC is 64-bit only. */
> - features.pauth = linux_get_hwcap (8) & AARCH64_HWCAP_PACA;
> + features.pauth = (linux_get_hwcap (pid, 8) & AARCH64_HWCAP_PACA);
Avoid adding the outer parenthesis.
> diff --git a/gdbserver/target.h b/gdbserver/target.h
> index 18ab969dda70..fe7a80b645bc 100644
> --- a/gdbserver/target.h
> +++ b/gdbserver/target.h
> @@ -175,7 +175,7 @@ class process_stratum_target
> /* Read auxiliary vector data from the inferior process.
>
> Read LEN bytes at OFFSET into a buffer at MYADDR. */
> - virtual int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
> + virtual int read_auxv (int pid, CORE_ADDR offset, unsigned char *myaddr,
Please update the doc of the method to replace "from the inferior
process" to from "process with pid PID".
Simon
next prev parent reply other threads:[~2022-11-28 15:07 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-26 2:04 [PATCH v2 0/6] gdbserver improvements for AArch64 SVE support Thiago Jung Bauermann
2022-11-26 2:04 ` [PATCH v2 1/6] gdbserver: Add asserts in register_size and register_data functions Thiago Jung Bauermann
2022-11-28 11:51 ` Luis Machado
2022-11-29 2:53 ` Thiago Jung Bauermann
2022-11-28 14:48 ` Simon Marchi
2022-11-28 14:53 ` Simon Marchi
2022-11-29 2:52 ` Thiago Jung Bauermann
2022-11-29 2:43 ` Thiago Jung Bauermann
2022-11-26 2:04 ` [PATCH v2 2/6] gdbserver: Add PID parameter to linux_get_auxv and linux_get_hwcap Thiago Jung Bauermann
2022-11-28 11:50 ` Luis Machado
2022-11-28 15:01 ` Simon Marchi
2022-11-29 3:10 ` Thiago Jung Bauermann
2022-11-28 15:07 ` Simon Marchi [this message]
2022-11-28 15:20 ` Luis Machado
2022-11-29 3:17 ` Thiago Jung Bauermann
2022-11-26 2:04 ` [PATCH v2 3/6] gdbserver/linux-aarch64: Factor out function to get aarch64_features Thiago Jung Bauermann
2022-11-28 11:54 ` Luis Machado
2022-11-29 3:19 ` Thiago Jung Bauermann
2022-11-28 15:12 ` Simon Marchi
2022-11-29 3:26 ` Thiago Jung Bauermann
2022-11-26 2:04 ` [PATCH v2 4/6] gdbserver/linux-aarch64: When thread stops, update its target description Thiago Jung Bauermann
2022-11-28 12:06 ` Luis Machado
2022-11-29 3:59 ` Thiago Jung Bauermann
2022-11-28 15:47 ` Simon Marchi
2022-11-28 16:01 ` Luis Machado
2022-11-28 16:07 ` Simon Marchi
2022-11-29 4:30 ` Thiago Jung Bauermann
2022-11-26 2:04 ` [PATCH v2 5/6] gdb/aarch64: Factor out most of the thread_architecture method Thiago Jung Bauermann
2022-11-28 12:09 ` Luis Machado
2022-11-29 4:32 ` Thiago Jung Bauermann
2022-11-28 16:09 ` Simon Marchi
2022-11-29 4:33 ` Thiago Jung Bauermann
2022-11-26 2:04 ` [PATCH v2 6/6] gdb/aarch64: Detect vector length changes when debugging remotely Thiago Jung Bauermann
2022-11-28 13:27 ` Luis Machado
2022-12-01 1:15 ` Thiago Jung Bauermann
2022-11-28 16:36 ` Simon Marchi
2022-12-01 3:16 ` Thiago Jung Bauermann
2022-12-01 8:32 ` Luis Machado
2022-12-01 16:16 ` Simon Marchi
2022-11-30 8:43 ` Luis Machado
2022-12-05 22:37 ` Thiago Jung Bauermann
2022-12-07 17:05 ` Luis Machado
2022-12-07 19:25 ` Simon Marchi
2022-12-07 23:01 ` Luis Machado
2022-12-09 2:20 ` Thiago Jung Bauermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43979fb5-a40b-9dd8-f4e6-bde0a598e505@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@arm.com \
--cc=thiago.bauermann@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).