summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2018-01-10 23:53:11 +0000
committerMatt Morehouse <mascasa@google.com>2018-01-10 23:53:11 +0000
commit527352b6ac01100f8a2d36ca895b663482202f00 (patch)
tree0204ccb9bda41ff89650a00b55d2e4c5c510edb6 /lldb/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py
parentcbafa59527258058c4a7fe269553be4d4f65c427 (diff)
downloadbcm5719-llvm-527352b6ac01100f8a2d36ca895b663482202f00.tar.gz
bcm5719-llvm-527352b6ac01100f8a2d36ca895b663482202f00.zip
SmallVector: fix use-after-poison MSAN error in destructor
Summary: Addresses issue: https://bugs.llvm.org/show_bug.cgi?id=34595 The topmost class, `SmallVector`, has internal storage for some elements; `N - 1` elements' bytes worth of space. Meanwhile a base class `SmallVectorTemplateCommon` has room for one element as well, totaling `N` elements' worth of space. The space for the N elements is contiguous and straddles `SmallVectorTemplateCommon` and `SmallVector`. A class "between" those two owning the storage, `SmallVectorImpl`, in its destructor, calls the destructor for elements contained in the vector, if any. It uses `destroy_range(begin, end)` and deletes all items in sequence, starting from the end. By the time the destructor for `SmallVectorImpl` is running, though, the memory for elements `[1, N)` is already poisoned, due to `SmallVector`'s destructor having done its thing already. So if the element type `T` has a nontrivial destructor that accesses any members of the `T` instance being destroyed, we'll run into a user-after-poison bug. This patch moves the destruction loop into `SmallVector`'s destructor, so any memory being accessed while dtors are running is not yet poisoned. Confirmed this broke before (and now works with this patch) with these compiler flags: -fsanitize=memory -fsanitize-memory-use-after-dtor -fsanitize-memory-track-origins and with the cmake flag `-DLLVM_USE_SANITIZER='MemoryWithOrigins;Undefined'` as well as `MSAN_OPTIONS=poison_in_dtor=1`. Patch By: elsteveogrande Reviewers: eugenis, morehouse, dblaikie Reviewed By: eugenis, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41916 llvm-svn: 322241
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud