Googletest export

Make sure sanitizers do not tamper with the stack here in StackLowerThanAddress().

PiperOrigin-RevId: 318082465
This commit is contained in:
Abseil Team 2020-06-24 12:47:04 -04:00 committed by Mark Barolak
parent 5e0cf72b7c
commit a4007e944f

View File

@ -1284,8 +1284,13 @@ static int ExecDeathTestChildMain(void* child_arg) {
// correct answer.
static void StackLowerThanAddress(const void* ptr,
bool* result) GTEST_NO_INLINE_;
// Make sure sanitizers do not tamper with the stack here.
// Ideally, we want to use `__builtin_frame_address` instead of a local variable
// address with sanitizer disabled, but it does not work when the
// compiler optimizes the stack frame out, which happens on PowerPC targets.
// HWAddressSanitizer add a random tag to the MSB of the local variable address,
// making comparison result unpredictable.
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
static void StackLowerThanAddress(const void* ptr, bool* result) {
int dummy;