summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
Commit message (Collapse)AuthorAgeFilesLines
* hwasan: Untag global variable addresses in tests.Peter Collingbourne2019-08-051-1/+3
| | | | | | | | | | | | Once we start instrumenting globals, all addresses including those of string literals that we pass to the operating system will start being tagged. Since we can't rely on the operating system to be able to cope with these addresses, we need to untag them before passing them to the operating system. This change introduces a macro that does so and uses it everywhere it is needed. Differential Revision: https://reviews.llvm.org/D65768 llvm-svn: 367938
* hwasan: Improve precision of checks using short granule tags.Peter Collingbourne2019-07-091-23/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A short granule is a granule of size between 1 and `TG-1` bytes. The size of a short granule is stored at the location in shadow memory where the granule's tag is normally stored, while the granule's actual tag is stored in the last byte of the granule. This means that in order to verify that a pointer tag matches a memory tag, HWASAN must check for two possibilities: * the pointer tag is equal to the memory tag in shadow memory, or * the shadow memory tag is actually a short granule size, the value being loaded is in bounds of the granule and the pointer tag is equal to the last byte of the granule. Pointer tags between 1 to `TG-1` are possible and are as likely as any other tag. This means that these tags in memory have two interpretations: the full tag interpretation (where the pointer tag is between 1 and `TG-1` and the last byte of the granule is ordinary data) and the short tag interpretation (where the pointer tag is stored in the granule). When HWASAN detects an error near a memory tag between 1 and `TG-1`, it will show both the memory tag and the last byte of the granule. Currently, it is up to the user to disambiguate the two possibilities. Because this functionality obsoletes the right aligned heap feature of the HWASAN memory allocator (and because we can no longer easily test it), the feature is removed. Also update the documentation to cover both short granule tags and outlined checks. Differential Revision: https://reviews.llvm.org/D63908 llvm-svn: 365551
* [hwasan] Switch to 64 allocator with a dense size class map.Evgeniy Stepanov2019-01-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Replace the 32-bit allocator with a 64-bit one with a non-constant base address, and reduce both the number of size classes and the maximum size of per-thread caches. As measured on [1], this reduces average weighted memory overhead (MaxRSS) from 26% to 12% over stock android allocator. These numbers include overhead from code instrumentation and hwasan shadow (i.e. not a pure allocator benchmark). This switch also enables release-to-OS functionality, which is not implemented in the 32-bit allocator. I have not seen any effect from that on the benchmark. [1] https://android.googlesource.com/platform/system/extras/+/master/memory_replay/ Reviewers: vitalybuka, kcc Subscribers: kubamracek, cryptoad, llvm-commits Differential Revision: https://reviews.llvm.org/D56239 llvm-svn: 350370
* [hwasan] make the heap-buffer-overflow.c test more robust and re-enable it. ↵Kostya Serebryany2018-11-171-3/+3
| | | | | | With malloc_align_right the relative offsets of heap chunks are less predictable to simply don't test for them. llvm-svn: 347118
* [hwasan] use reads instead of writes in a testKostya Serebryany2018-11-161-1/+3
| | | | llvm-svn: 347107
* [hwasan] disable one test line while investigating a bot failureKostya Serebryany2018-11-161-1/+1
| | | | llvm-svn: 347091
* [hwasan] optionally right-align heap allocationsKostya Serebryany2018-11-161-6/+30
| | | | | | | | | | | | | | | | | Summary: ... so that we can find intra-granule buffer overflows. The default is still to always align left. It remains to be seen wether we can enable this mode at scale. Reviewers: eugenis Reviewed By: eugenis Subscribers: jfb, dvyukov, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D53789 llvm-svn: 347082
* [hwasan] relax a testKostya Serebryany2018-10-111-3/+3
| | | | llvm-svn: 344289
* [hwasan] when reporting a bug, print some very basic information about the ↵Kostya Serebryany2018-10-101-0/+9
| | | | | | heap chunk (in addition to the more detailed info that we may fail to show) llvm-svn: 344193
* [hwasan] tests for a buffer overflow with a large allocationKostya Serebryany2018-09-121-1/+6
| | | | llvm-svn: 342011
* [hwasan] more heap-buffer-overflow testsKostya Serebryany2018-08-311-5/+10
| | | | llvm-svn: 341162
* [hwasan] properly report heap-buffer-overflowKostya Serebryany2018-08-311-0/+16
llvm-svn: 341159
OpenPOWER on IntegriCloud