public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Alan Hayward <Alan.Hayward@arm.com>
Cc: GDB Patches <gdb-patches@sourceware.org>, nd <nd@arm.com>
Subject: Re: [PATCH v2 0/2] Aarch64: Fix segfault when casting dummy calls
Date: Wed, 10 Oct 2018 08:23:00 -0000	[thread overview]
Message-ID: <b85c80fb-7edf-a12e-3685-aa62673812ab@redhat.com> (raw)
In-Reply-To: <CD1F1B57-4F9D-4FFC-8EB1-7C3DCB0F48AD@arm.com>

On 10/09/2018 06:50 PM, Alan Hayward wrote:
> 
> 
>> On 9 Oct 2018, at 17:10, Pedro Alves <palves@redhat.com> wrote:
>>
>> On 10/01/2018 04:52 PM, Alan Hayward wrote:
>>> This is a reworking of a patch I posted in March.
>>> V1 had a long discussion which was then paused to wait for
>>> Pedro's IFUNC rewrite.
>>>
>>>
>>> Prevent the int cast in the following causing a segfault on aarch64:
>>> (gdb) b foo if (int)strcmp(name,"abc") == 0
>>> (gdb) run
>>>
>>>
>>> This is because to aarch64_push_dummy_call determines the return type
>>> of the function and then does not check for null pointer.
>>>
>>> A null pointer for the return type means either 1) the call has a
>>> cast or 2) an error has occured.
>>
>> I'd think that "1) the call has a cast" is not accurate.
>> If the called function has debug info, then GDB will know
>> it's return type.  The issue is that the called function may
>> not have debug information, and then GDB does not know
>> its return type (so its NULL), and then the only way to
>> call the function is to add the cast.  Right?
>>
> 
> That makes sense. I’d add that in the above example I’m able to do the
> break without a cast and gdb does not segfault - the return type
> of the function comes back as an int. 

Please double check whether the proposed testcase crashes GDB without
the fix.  I suspect not, due to the library being compiled with
debug info.  If it does crash, then I think I'm missing something.

Thanks,
Pedro Alves

  reply	other threads:[~2018-10-10  8:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01 15:53 Alan Hayward
2018-10-01 15:53 ` [PATCH v2 2/2] " Alan Hayward
2018-10-09 16:15   ` Pedro Alves
2018-10-01 15:53 ` [PATCH v2 1/2] Add lang_struct_return to _push_dummy_call Alan Hayward
2018-10-09 16:14   ` Pedro Alves
2018-10-10 11:54     ` Alan Hayward
2018-10-09  8:26 ` [PING][PATCH v2 0/2] Aarch64: Fix segfault when casting dummy calls Alan Hayward
2018-10-09 16:10 ` [PATCH " Pedro Alves
2018-10-09 17:50   ` Alan Hayward
2018-10-10  8:23     ` Pedro Alves [this message]
2018-10-10 11:54       ` Alan Hayward

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=b85c80fb-7edf-a12e-3685-aa62673812ab@redhat.com \
    --to=palves@redhat.com \
    --cc=Alan.Hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    /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).