This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/4] Poison non-POD memset & non-trivially-copyable memcpy/memmove

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:

[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.
  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]