Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Don't override operator new if GDB is built with -fsanitize=address
Date: Tue, 25 Oct 2016 10:40:00 -0000	[thread overview]
Message-ID: <49110e6f-e2e0-e5ab-75cf-04a29654fa5f@redhat.com> (raw)
In-Reply-To: <8800a3ba-856f-dbc2-c350-ae06309d38ba@redhat.com>

On 10/25/2016 11:38 AM, Pedro Alves wrote:
> How about this follow up?

On 10/25/2016 11:38 AM, Pedro Alves wrote:

> +++ b/gdb/common/new-op.c
> @@ -33,6 +33,12 @@
>     new-handler function instead (std::set_new_handler) because we want
>     to catch allocation errors from within global constructors too.
>  +   Skip overriding if building with -fsanitize=address though.
> +   Address sanitizer wants to override operator new/delete too in

Bah, looks like "edit as new" with Thunderbird messed
up the patch...  Here it is again...

From e58eb16a5f27b1ee39c45642a80da7364763a07b Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 25 Oct 2016 11:20:03 +0100
Subject: [PATCH] new-op.c: Add comment about -fsanitize=address

gdb/ChangeLog:
2016-10-25  Pedro Alves  <palves@redhat.com>

	* common/new-op.c: Add comment about -fsanitize=address.
---
 gdb/common/new-op.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/common/new-op.c b/gdb/common/new-op.c
index f04c5cb..1eb4f94 100644
--- a/gdb/common/new-op.c
+++ b/gdb/common/new-op.c
@@ -33,6 +33,12 @@
    new-handler function instead (std::set_new_handler) because we want
    to catch allocation errors from within global constructors too.
 
+   Skip overriding if building with -fsanitize=address though.
+   Address sanitizer wants to override operator new/delete too in
+   order to detect malloc+delete and new+free mismatches.  Our
+   versions would mask out ASan's, with the result of losing that
+   useful mismatch detection.
+
    Note that C++ implementations could either have their throw
    versions call the nothrow versions (libstdc++), or the other way
    around (clang/libc++).  For that reason, we replace both throw and
-- 
2.5.5



  reply	other threads:[~2016-10-25 10:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25  9:21 Yao Qi
2016-10-25  9:39 ` Pedro Alves
     [not found]   ` <CAH=s-POJSmo1rm2JaxmSG7GwqYqRxgv0tMYJKYcix8ddcvctFw@mail.gmail.com>
2016-10-25 10:38     ` Pedro Alves
2016-10-25 10:40       ` Pedro Alves [this message]
2016-10-25 11:39         ` Yao Qi
2016-10-25 12:33           ` Pedro Alves

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=49110e6f-e2e0-e5ab-75cf-04a29654fa5f@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.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