Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] Poison non-POD memset & non-trivially-copyable memcpy/memmove
@ 2017-04-13  2:27 Pedro Alves
  2017-04-13  2:28 ` [PATCH 3/5] Don't memset non-POD types: struct bp_location Pedro Alves
                   ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Pedro Alves @ 2017-04-13  2:27 UTC (permalink / raw)
  To: gdb-patches

Here's a version of the hack at
<https://sourceware.org/ml/gdb-patches/2017-04/msg00357.html> 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


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2017-05-17 13:20 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13  2:27 [PATCH 0/4] Poison non-POD memset & non-trivially-copyable memcpy/memmove Pedro Alves
2017-04-13  2:28 ` [PATCH 3/5] Don't memset non-POD types: struct bp_location Pedro Alves
2017-04-13  2:28 ` [PATCH 2/5] Don't memcpy non-trivially-copyable types: Make enum_flags triv. copyable Pedro Alves
2017-04-20  3:34   ` Simon Marchi
2017-04-25  1:10     ` Pedro Alves
2017-04-13  2:28 ` [PATCH 4/5] Don't memset non-POD types: struct btrace_insn Pedro Alves
2017-04-13  7:57   ` Metzger, Markus T
2017-04-25  1:11     ` Pedro Alves
2017-04-13  2:28 ` [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove Pedro Alves
2017-04-20  3:27   ` Simon Marchi
2017-04-25  1:14     ` Pedro Alves
2017-04-25  1:19       ` Pedro Alves
2017-04-25  8:24       ` Yao Qi
2017-04-25  9:24         ` Pedro Alves
2017-04-25 10:02           ` Pedro Alves
2017-04-24  1:12   ` Simon Marchi
2017-04-24  1:53     ` Simon Marchi
2017-04-27 13:58       ` Pedro Alves
2017-04-30  1:51         ` Simon Marchi
2017-05-17 11:35           ` Pedro Alves
2017-05-17 13:11             ` Simon Marchi
2017-05-17 13:20               ` Pedro Alves
2017-04-27 13:57     ` Pedro Alves
2017-04-13  2:35 ` [PATCH 5/5] Don't memset non-POD types: struct breakpoint Pedro Alves
2017-04-20  4:00   ` Simon Marchi
2017-04-25  1:11     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox