Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Paul Koning <paulkoning@comcast.net>, Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb] fix unsigned overflow in charset.c
Date: Tue, 09 Oct 2018 17:57:00 -0000	[thread overview]
Message-ID: <9ea7a1f6-5c3f-c569-6bba-ca9e21711de1@FreeBSD.org> (raw)
In-Reply-To: <FBF59187-8B90-4A9C-B44C-C98F27A676AA@comcast.net>

On 10/9/18 10:40 AM, Paul Koning wrote:
> 
> 
>> On Oct 9, 2018, at 1:31 PM, Pedro Alves <palves@redhat.com> wrote:
>>
>> On 10/09/2018 06:19 PM, Paul Koning wrote:
>>> This fixed an overflow in pointer arithmetic that crashes GDB on Mac OS.
>>
>> _unsigned_ overflow?  That isn't undefined.  Do we really want to trap
>> those?  I don't think GCC's version does that.
>>
>> From: 
>>  https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#silencing-unsigned-integer-overflow
>> seems like there's a way to disable it.
>>
>> Thanks,
>> Pedro Alves
> 
> You're right, it was an LLVM build.  I know unsigned overflow is well defined with integers; is that true for pointers?
> 
> Given that GDB triggers this issue, should the GDB build do that LLVM workaround if LLVM is used to build it?  
> 
> But it seems simpler to use the proposed patch; clearly the intent is to back up a pointer by -(space_left) and doing that operation on a signed type seems like a logical thing to do, it makes the intended meaning clear.

I also ran into the same failure using LLVM's ubsan on FreeBSD but in a different
use of obstack_blank_fast().  If we wanted to fix this, I wonder if we'd instead
want to fix it centrally in obstack_blank_fast (e.g. by using a ptrdiff_t cast)
rather than fixing various consumers of the API.  That would be a change to
libiberty though, not just gdb.

-- 
John Baldwin

                                                                            


  reply	other threads:[~2018-10-09 17:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 17:19 Paul Koning
2018-10-09 17:31 ` Pedro Alves
2018-10-09 17:40   ` Paul Koning
2018-10-09 17:57     ` John Baldwin [this message]
2018-10-09 18:10       ` Paul Koning
2018-10-09 19:58         ` John Baldwin
2018-10-10  8:51           ` Pedro Alves
2018-10-11 20:16             ` John Baldwin
2018-10-16 15:58               ` Pedro Alves
2018-10-17 18:38                 ` John Baldwin
2018-10-17 18:47                   ` Paul Koning
2018-10-17 21:51                     ` Pedro Alves
2018-10-17 23:28                       ` Paul Koning

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=9ea7a1f6-5c3f-c569-6bba-ca9e21711de1@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=paulkoning@comcast.net \
    /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