From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104536 invoked by alias); 13 Apr 2017 02:27:58 -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 104102 invoked by uid 89); 13 Apr 2017 02:27:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=2-5, 2-4 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; Thu, 13 Apr 2017 02:27:56 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E48FC054C5A for ; Thu, 13 Apr 2017 02:27:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7E48FC054C5A Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7E48FC054C5A Received: from cascais.lan (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 105C117175 for ; Thu, 13 Apr 2017 02:27:55 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 0/4] Poison non-POD memset & non-trivially-copyable memcpy/memmove Date: Thu, 13 Apr 2017 02:27:00 -0000 Message-Id: <1492050475-9238-1-git-send-email-palves@redhat.com> X-SW-Source: 2017-04/txt/msg00378.txt.bz2 Here's a version of the hack at that I'm not shy about proposing to master. The original idea was to catch invalid initialization of non-POD types with memset, at compile time. After posting the above, I thought it'd be good to catch invalid uses of memcpy/memmove too, in a similar way. Unlike the version linked above, this version does not use macros. Instead it simply defines deleted memset/memcpy/memmove overloads. Yay C++11! Patch #1 adds the poisoning of invalid memset/memcpy/memmove. Patches 2-4^W 2-5 [1] fix problems the poisoning detected, except the "struct inferior", which is already fixed by this other series: https://sourceware.org/ml/gdb-patches/2017-04/msg00298.html [1] another instance just made it into the tree, so I do think it's a good idea to add the poisoning to master. Tested on x86-64 Fedora 23, along with the struct inferior fix. Pedro Alves (5): Poison non-POD memset & non-trivially-copyable memcpy/memmove Don't memcpy non-trivially-copyable types: Make enum_flags triv. copyable Don't memset non-POD types: struct bp_location Don't memset non-POD types: struct btrace_insn Don't memset non-POD types: struct breakpoint gdb/ada-lang.c | 19 +++---- gdb/breakpoint.c | 23 ++------- gdb/breakpoint.h | 125 +++++++++++++++++++++++---------------------- gdb/btrace.c | 19 ++++--- gdb/common/common-defs.h | 1 + gdb/common/enum-flags.h | 15 +++--- gdb/common/function-view.h | 40 ++------------- gdb/common/poison.h | 83 ++++++++++++++++++++++++++++++ gdb/common/traits.h | 55 ++++++++++++++++++++ 9 files changed, 234 insertions(+), 146 deletions(-) create mode 100644 gdb/common/poison.h -- 2.5.5