Homec4science

Googletest export

Authored by Abseil Team <absl-team@google.com> on Apr 1 2019, 21:44.

Description

Googletest export

Add HWASan annotations.

These mirror existing ASan annotations.

HWASan uses memory (address) tagging to detect memory errors:
https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html

It inserts a random tag in the MSB of heap and stack allocation addresses. This tag dominates pointer comparison in StackGrowsDown(), making the result non-deterministic, and entirely unrelated to the actual stack growth direction. The function attribute disables this behavior.

The annotations in gtest-printers are there because the printers are used to basically dump memory. The sanitizers may have ideas why this memory should not be accessed, and that is counter productive. In particular, the test may access only part of an array, but in case of a test failure gtest will dump the entire array which may contain uninitialized bytes - that's what SANITIZE_MEMORY annotation is for. There are similar reasons for ADDRESS and THREAD annotations. HWADDRESS in its current implementation can not cause issues there, I believe, but it falls under the same umbrella of tools whose checking should not apply to test printers because it is not the code under test.

PiperOrigin-RevId: 241379822

Details

Event Timeline

Gennadiy Civil <misterg@google.com> committed R9484:b617b277186e: Googletest export (authored by Abseil Team <absl-team@google.com>).Apr 1 2019, 21:45