From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92997 invoked by alias); 17 May 2017 13:11:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 92987 invoked by uid 89); 17 May 2017 13:11:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=Hx-languages-length:1698, Discussion, neat, month X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 May 2017 13:11:16 +0000 Received: by simark.ca (Postfix, from userid 33) id 4DC721E4A4; Wed, 17 May 2017 09:11:18 -0400 (EDT) To: Pedro Alves Subject: Re: [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 17 May 2017 13:11:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <0e73c6f0-4719-79e6-26bd-e31587b531af@redhat.com> References: <1492050475-9238-1-git-send-email-palves@redhat.com> <1492050475-9238-2-git-send-email-palves@redhat.com> <9ee5551a7999a72a0040f15e6e5410a1@polymtl.ca> <9c15c7f2d50cdb53f39719dba3eb589e@polymtl.ca> <0e73c6f0-4719-79e6-26bd-e31587b531af@redhat.com> Message-ID: <93dda70d456b9dff638d469bc7a5dc0c@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.5 X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00386.txt.bz2 On 2017-05-17 07:35, Pedro Alves wrote: > On 04/30/2017 02:51 AM, Simon Marchi wrote: > >> I think it would be a good guideline to use new/delete for types that >> have some C++-related stuff in them, even if it's not technically >> necessary. >> >> Note that this won't be bulletproof also because at many places xfree >> is >> used on a void pointer, so we don't know what we're really free'ing. >> In >> some other cases, objects are freed using a pointer to their "C base >> class". > > Yeah. Still, better than nothing. > > BTW, GCC ran into similar issues almost at the same time > we started discussing this, and I've been discussing > with the GCC folks about a new GCC warning that flags invalid > memcpy/memset misuses. Martin Sebor has been working on a patch > and it's getting close to be merged, AFAICT. > > See: > https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01527.html > First version of the GCC patch here: > https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01571.html > Discussion crossed month boundary here: > https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00925.html > Latest patch is here: > https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00976.html > > I won't be a full replacement since we'll still want our > poisoning for other functions (xmalloc, xfree, etc.). And > then there's current/older gccs. But still, pretty neat, IMO. Thanks for the info! I have a branch in progress about poisoning XNEW and friends: https://github.com/simark/binutils-gdb/commits/poison-xnew I won't have time to look at it until at least next week, if anybody wants to pick it up, they are free to do so. Simon