[PATCH] D119300: Use-after-dtor detection for trivial base classes.

Evgenii Stepanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 8 15:44:26 PST 2022


eugenis created this revision.
eugenis added reviewers: kda, vitalybuka.
eugenis requested review of this revision.
Herald added projects: clang, Sanitizers.
Herald added a subscriber: Sanitizers.

-fsanitize-memory-use-after-dtor detects memory access after a
subobject is destroyed but its memory is not yet deallocated.
This is done by poisoning each object memory near the end of its destructor.

Subobjects (members and base classes) do this in their respective
destructors, and the parent class does the same for its members with
trivial destructors.

Inexplicably, base classes with trivial destructors are not handled at
all. This change fixes this oversight by adding the base class poisoning logic
to the parent class destructor.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119300

Files:
  clang/lib/CodeGen/CGClass.cpp
  clang/test/CodeGenCXX/sanitize-dtor-trivial-base.cpp
  compiler-rt/test/msan/dtor-base-access.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119300.407004.patch
Type: text/x-patch
Size: 7244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220208/2dfe4f5c/attachment.bin>


More information about the cfe-commits mailing list