summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest-death-test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-06-24 16:47:04 (GMT)
committerMark Barolak <mbar@google.com>2020-06-26 16:03:36 (GMT)
commita4007e944fe2e3d08aab547baeb2d5a4a59cbdc8 (patch)
tree59fa3a99e0cce8340ed59a27f7714c417883f2b1 /googletest/src/gtest-death-test.cc
parent5e0cf72b7cd0ee0b1d66308da708c103caadce51 (diff)
downloadgoogletest-a4007e944fe2e3d08aab547baeb2d5a4a59cbdc8.zip
googletest-a4007e944fe2e3d08aab547baeb2d5a4a59cbdc8.tar.gz
googletest-a4007e944fe2e3d08aab547baeb2d5a4a59cbdc8.tar.bz2
Googletest export
Make sure sanitizers do not tamper with the stack here in StackLowerThanAddress(). PiperOrigin-RevId: 318082465
Diffstat (limited to 'googletest/src/gtest-death-test.cc')
-rw-r--r--googletest/src/gtest-death-test.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index 5d1031b..121d2bb 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -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;