* [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface
@ 2021-08-16 15:27 H.J. Lu
2021-08-16 16:26 ` Simon Marchi
0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2021-08-16 15:27 UTC (permalink / raw)
To: gdb-patches, GNU C Library
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);
}
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface
2021-08-16 15:27 [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface H.J. Lu
@ 2021-08-16 16:26 ` Simon Marchi
2021-08-16 18:02 ` H.J. Lu
0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2021-08-16 16:26 UTC (permalink / raw)
To: H.J. Lu, gdb-patches, GNU C Library
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface
2021-08-16 16:26 ` Simon Marchi
@ 2021-08-16 18:02 ` H.J. Lu
2021-08-16 18:08 ` Simon Marchi
0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2021-08-16 18:02 UTC (permalink / raw)
To: Simon Marchi; +Cc: GDB, GNU C Library
On Mon, Aug 16, 2021 at 9:26 AM Simon Marchi <simon.marchi@polymtl.ca> wrote:
>
> 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
No. The all glibc debugger interface changes will be backward compatible.
> 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
Since all future interface changes will be backward compatible, gdbserver
just needs to check r_version for incompatible implementation. Since the
current gdbserver only reads fields defined for r_version == 1, it is compatible
with r_version >= 1.
> it will potentially interpret the data in a wrong way and behave badly.
>
> Simon
--
H.J.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface
2021-08-16 18:02 ` H.J. Lu
@ 2021-08-16 18:08 ` Simon Marchi
2021-08-16 18:10 ` H.J. Lu
0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2021-08-16 18:08 UTC (permalink / raw)
To: H.J. Lu; +Cc: GDB, GNU C Library
On 2021-08-16 2:02 p.m., H.J. Lu wrote:
> On Mon, Aug 16, 2021 at 9:26 AM Simon Marchi <simon.marchi@polymtl.ca> wrote:
>>
>> 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
>
> No. The all glibc debugger interface changes will be backward compatible.
Ok, this is an important piece of information, please add it to the
commit message.
>> 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
>
> Since all future interface changes will be backward compatible, gdbserver
> just needs to check r_version for incompatible implementation. Since the
> current gdbserver only reads fields defined for r_version == 1, it is compatible
> with r_version >= 1.
I'm just curious, if there is ever the need to do a backwards
incompatible change, how would that be handled?
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface
2021-08-16 18:08 ` Simon Marchi
@ 2021-08-16 18:10 ` H.J. Lu
0 siblings, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2021-08-16 18:10 UTC (permalink / raw)
To: Simon Marchi; +Cc: GDB, GNU C Library
On Mon, Aug 16, 2021 at 11:08 AM Simon Marchi <simon.marchi@polymtl.ca> wrote:
>
> On 2021-08-16 2:02 p.m., H.J. Lu wrote:
> > On Mon, Aug 16, 2021 at 9:26 AM Simon Marchi <simon.marchi@polymtl.ca> wrote:
> >>
> >> 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
> >
> > No. The all glibc debugger interface changes will be backward compatible.
>
> Ok, this is an important piece of information, please add it to the
> commit message.
Will do.
> >> 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
> >
> > Since all future interface changes will be backward compatible, gdbserver
> > just needs to check r_version for incompatible implementation. Since the
> > current gdbserver only reads fields defined for r_version == 1, it is compatible
> > with r_version >= 1.
>
> I'm just curious, if there is ever the need to do a backwards
> incompatible change, how would that be handled?
If it does happen, we will provide its access via a new DT_XXX element.
--
H.J.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-16 18:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 15:27 [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface H.J. Lu
2021-08-16 16:26 ` Simon Marchi
2021-08-16 18:02 ` H.J. Lu
2021-08-16 18:08 ` Simon Marchi
2021-08-16 18:10 ` H.J. Lu
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).