This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 17 May 2017 09:11:18 -0400
- Subject: Re: [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
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
Note that this won't be bulletproof also because at many places xfree
used on a void pointer, so we don't know what we're really free'ing.
some other cases, objects are freed using a pointer to their "C base
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.
First version of the GCC patch here:
Discussion crossed month boundary here:
Latest patch is here:
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:
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.