Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: arnez@linux.vnet.ibm.com, jan.kratochvil@redhat.com,
	       gdb-patches@sourceware.org
Subject: Re: [testsuite patch] for: [PATCH] [PR corefiles/17808] i386: Fix internal error when prstatus in core file is too big
Date: Fri, 09 Jan 2015 17:19:00 -0000	[thread overview]
Message-ID: <54B00D92.4050409@redhat.com> (raw)
In-Reply-To: <201501091659.t09GxO1q016197@glazunov.sibelius.xs4all.nl>

On 01/09/2015 04:59 PM, Mark Kettenis wrote:
>> Date: Fri, 09 Jan 2015 16:27:12 +0000
>> From: Pedro Alves <palves@redhat.com>
>>
>>> Any other comments?
>>
>> Do we need to do the same in other places?  This grep seems to suggest yes:
>>
>> $ grep assert * | grep sizeof | grep regset
>> amd64obsd-tdep.c:  gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
>> amd64-tdep.c:  gdb_assert (len == tdep->sizeof_fpregset);
>> amd64-tdep.c:  gdb_assert (len == tdep->sizeof_fpregset);
>> i386obsd-tdep.c:  gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
>> i386-tdep.c:  gdb_assert (len == tdep->sizeof_gregset);
>> i386-tdep.c:  gdb_assert (len == tdep->sizeof_gregset);
>> i386-tdep.c:  gdb_assert (len == tdep->sizeof_fpregset);
>> i386-tdep.c:  gdb_assert (len == tdep->sizeof_fpregset);
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips_elf_gregset_t));
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips_elf_gregset_t));
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips_elf_fpregset_t));
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips_elf_fpregset_t));
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips64_elf_gregset_t));
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips64_elf_gregset_t));
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips64_elf_fpregset_t));
>> mips-linux-tdep.c:  gdb_assert (len == sizeof (mips64_elf_fpregset_t));
>> mn10300-linux-tdep.c:  gdb_assert (len == sizeof (mn10300_elf_gregset_t));
>> mn10300-linux-tdep.c:  gdb_assert (len == sizeof (mn10300_elf_fpregset_t));
>> mn10300-linux-tdep.c:  gdb_assert (len == sizeof (mn10300_elf_gregset_t));
>>
>> On 01/08/2015 04:16 PM, Andreas Arnez wrote:
>>> Note that this behavior deviates from the default policy: In general, if
>>> some future kernel adds new registers to a register set, then a GDB
>>> unaware of this extension would read the known subset and just ignore
>>> the unknown bytes.
>>
>> That's a good point.
>>
>> get_core_register_section checks the section size already:
>>
>> get_core_register_section (struct regcache *regcache,
>> 			   const struct regset *regset,
>> 			   const char *name,
>> 			   int min_size,
>> 			   int which,
>> 			   const char *human_name,
>> 			   int required)
>> {
>> ...
>>   size = bfd_section_size (core_bfd, section);
>>   if (size < min_size)
>>     {
>>       warning (_("Section `%s' in core file too small."), section_name);
>>       return;
>>     }
>> ...
>>
>> Should we remove all those asserts, and make it the
>> job of get_core_register_section to warn if the section
>> size is bigger than expected?  We may need to pass
>> the "expected" section size to the callback, in addition
>> to the "minimum" size though.
> 
> The code is designed to allow these sections to grow such that the OS
> kernel can add more registers without breaking GDB.

Not sure what you're disagreeing with.  My comment is in that direction
too (And Andreas' comment I'm quoting).  That is, get_core_register_section
would warn, but still continue processing the section.

The current code clearly does not work that way, given the assertions.

Thanks,
Pedro Alves


  reply	other threads:[~2015-01-09 17:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 16:16 Andreas Arnez
2015-01-08 16:43 ` [testsuite patch] for: " Jan Kratochvil
2015-01-09  9:47   ` Andreas Arnez
2015-01-09 16:45     ` Pedro Alves
2015-01-09 16:59       ` Mark Kettenis
2015-01-09 17:19         ` Pedro Alves [this message]
2015-01-09 19:35           ` Mark Kettenis
2015-01-09 20:11             ` Pedro Alves
2015-01-09 20:30               ` Mark Kettenis
2015-01-12 14:30                 ` Andreas Arnez
2015-01-09 19:27       ` Andreas Arnez
2015-02-05  7:38   ` ping: " Jan Kratochvil
2015-02-05  9:47     ` Pedro Alves
2015-02-14 15:12       ` Jan Kratochvil
2015-02-17 12:56         ` Pedro Alves
2015-02-17 16:56           ` Jan Kratochvil
2015-02-21 14:28             ` [commit] " Jan Kratochvil
2015-07-14  8:52             ` ping: " Yao Qi
2015-07-14 18:07               ` Jan Kratochvil
2015-07-15 16:14                 ` Yao Qi
2015-07-15 16:58                   ` Jan Kratochvil
2015-07-16 14:15                     ` Yao Qi
2015-07-16 14:37                       ` Jan Kratochvil
2015-07-16 15:35                         ` Yao Qi
2015-07-16 16:10                           ` [commit] " Jan Kratochvil

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=54B00D92.4050409@redhat.com \
    --to=palves@redhat.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /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