From: Simon Marchi <simon.marchi@polymtl.ca>
To: "H.J. Lu" <hjl.tools@gmail.com>,
gdb-patches@sourceware.org,
GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface
Date: Mon, 16 Aug 2021 12:26:33 -0400 [thread overview]
Message-ID: <927e3b80-eec2-7910-c7ce-8c6975e3a38f@polymtl.ca> (raw)
In-Reply-To: <YRqD+iTeKfkn94Nn@gmail.com>
On 2021-08-16 11:27 a.m., H.J. Lu via Gdb-patches wrote:
> Update gdbserver to check r_version < 1 instead of r_version != 1 so
> that r_version can be bumped for a new field in the glibc debugger
> interface to support multiple namespaces.
>
> PR gdb/11839
> * linux-low.cc (linux_process_target::qxfer_libraries_svr4):
> Check r_version < 1 instead of r_version != 1.
> ---
> gdbserver/linux-low.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
> index 5c6191d941c..fc7a995351d 100644
> --- a/gdbserver/linux-low.cc
> +++ b/gdbserver/linux-low.cc
> @@ -6845,7 +6845,7 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex,
> if (linux_read_memory (priv->r_debug + lmo->r_version_offset,
> (unsigned char *) &r_version,
> sizeof (r_version)) != 0
> - || r_version != 1)
> + || r_version < 1)
> {
> warning ("unexpected r_debug version %d", r_version);
> }
>
I don't understand how this change on its own is useful. If r_version
gets bumped from 1 to 2, it's presumably because there are backwards
incompatible changes done to the interface. Without the corresponding
changes to adjust to that new interface, then we just risk having a
gdbserver trying to read a library list with r_version == 2 without
actually knowing how to read a library list with r_version == 2. So
it will potentially interpret the data in a wrong way and behave badly.
Simon
next prev parent reply other threads:[~2021-08-16 16:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-16 15:27 H.J. Lu
2021-08-16 16:26 ` Simon Marchi [this message]
2021-08-16 18:02 ` H.J. Lu
2021-08-16 18:08 ` Simon Marchi
2021-08-16 18:10 ` H.J. Lu
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=927e3b80-eec2-7910-c7ce-8c6975e3a38f@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.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).