From patchwork Tue Oct 25 10:38:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 16788 Received: (qmail 20926 invoked by alias); 25 Oct 2016 10:38:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 20907 invoked by uid 89); 25 Oct 2016 10:38:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1456, H*M:856f, our, 2016-10-25 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Oct 2016 10:38:15 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5B193D962; Tue, 25 Oct 2016 10:38:14 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9PAcDVg021251; Tue, 25 Oct 2016 06:38:14 -0400 From: Pedro Alves Subject: Re: [PATCH] Don't override operator new if GDB is built with -fsanitize=address To: Yao Qi , GDB Patches References: <1477387295-24846-1-git-send-email-yao.qi@linaro.org> <6afd5d0c-5e8e-1edb-5fa7-cd7c80d493df@redhat.com> Message-ID: <8800a3ba-856f-dbc2-c350-ae06309d38ba@redhat.com> Date: Tue, 25 Oct 2016 11:38:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: [Re-adding the list.] On 10/25/2016 11:15 AM, Yao Qi wrote: > On Tue, Oct 25, 2016 at 10:39 AM, Pedro Alves wrote: >> >> LGTM. >> > > Patch is pushed in. > How about this follow up? From e58eb16a5f27b1ee39c45642a80da7364763a07b Mon Sep 17 00:00:00 2001 From: Pedro Alves 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 * 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