diff options
author | Advenam Tacet <advenam.tacet@trailofbits.com> | 2023-02-23 20:45:57 +0100 |
---|---|---|
committer | Nikolas Klauser <nikolasklauser@berlin.de> | 2023-02-23 20:46:05 +0100 |
commit | a9356a515b5a1a3637eaf5820fc0d2c0dad21a64 (patch) | |
tree | dbdf4a53af5147cfbc8e27df22fbce32b666c651 /llvm/lib/CodeGen/MachineModuleInfo.cpp | |
parent | c21378f90a4442810adc4af924a83a9c222fdc51 (diff) | |
download | llvm-a9356a515b5a1a3637eaf5820fc0d2c0dad21a64.zip llvm-a9356a515b5a1a3637eaf5820fc0d2c0dad21a64.tar.gz llvm-a9356a515b5a1a3637eaf5820fc0d2c0dad21a64.tar.bz2 |
[ASan][libcxx] Annotating std::vector with all allocators
This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection
capabilities by adding annotations, similar to those existing
in std::vector, to std::string and std::deque collections.
These changes allow ASan to detect cases when the instrumented
program accesses memory which is internally allocated by
the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).
The motivation for the research and those changes was a bug,
found by Trail of Bits, in a real code where an out-of-bounds read
could happen as two strings were compared via a std::equals function
that took iter1_begin, iter1_end, iter2_begin iterators
(with a custom comparison function).
When object iter1 was longer than iter2, read out-of-bounds on iter2
could happen. Container sanitization would detect it.
In revision D132522, support for non-aligned memory buffers (sharing
first/last granule with other objects) was added, therefore the
check for standard allocator is not necessary anymore.
This patch removes the check in std::vector annotation member
function (__annotate_contiguous_container) to support
different allocators.
Additionally, this revision fixes unpoisoning in std::vector.
It guarantees that __alloc_traits::deallocate may access returned memory.
Originally suggested in D144155 revision.
If you have any questions, please email:
- advenam.tacet@trailofbits.com
- disconnect3d@trailofbits.com
Reviewed By: #libc, #sanitizers, philnik, vitalybuka
Spies: hans, EricWF, philnik, #sanitizers, libcxx-commits
Differential Revision: https://reviews.llvm.org/D136765
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
0 files changed, 0 insertions, 0 deletions