Reland^2 "[wasm][test] Fix test expectation"
This is a reland ofa55c82d46b
, now also fixed for UBSan. Original change's description: > Reland "[wasm][test] Fix test expectation" > > This is a reland of6f9cde1ee6
, with > special handling for MSan as well. > > Original change's description: > > [wasm][test] Fix test expectation > > > > In the mprotect case, there could be one or multiple succeeding writes > > until we finally crash. Thus do not check that we never successfully > > write, but just check that the last printed statement is *before* a > > write. > > > > R=jkummerow@chromium.org > > > > Bug: v8:12226 > > Change-Id: I04209691a9320a9b29dd0ec364539e062ad2dc03 > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3160343 > > Commit-Queue: Clemens Backes <clemensb@chromium.org> > > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#76829} > > Bug: v8:12226 > Cq-Include-Trybots: luci.v8.try:v8_linux64_msan_rel_ng > Change-Id: I85ca98be43fc1d933d39a4602194e1771c33007c > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3162037 > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> > Commit-Queue: Clemens Backes <clemensb@chromium.org> > Cr-Commit-Position: refs/heads/main@{#76839} Bug: v8:12226 Change-Id: I911295b73a385c899a993a729db3a499e58b7cb6 Cq-Include-Trybots: luci.v8.try:v8_linux64_msan_rel_ng Cq-Include-Trybots: luci.v8.try:v8_linux64_ubsan_rel_ng Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3162041 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#76841}
This commit is contained in:
parent
2872775fd9
commit
6599863141
@ -162,6 +162,13 @@ V8_INLINE Dest bit_cast(Source const& source) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Define V8_USE_UNDEFINED_BEHAVIOR_SANITIZER macro.
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(undefined_behavior_sanitizer)
|
||||
#define V8_USE_UNDEFINED_BEHAVIOR_SANITIZER 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// DISABLE_CFI_PERF -- Disable Control Flow Integrity checks for Perf reasons.
|
||||
#define DISABLE_CFI_PERF V8_CLANG_NO_SANITIZE("cfi")
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <signal.h>
|
||||
#endif // V8_OS_POSIX && !V8_OS_FUCHSIA
|
||||
|
||||
#include "src/base/macros.h"
|
||||
#include "src/flags/flags.h"
|
||||
#include "src/wasm/code-space-access.h"
|
||||
#include "src/wasm/module-compiler.h"
|
||||
@ -230,10 +231,10 @@ class ParameterizedMemoryProtectionTestWithSignalHandling
|
||||
if (uint8_t* write_address = current_handler_scope_->code_address_) {
|
||||
// Print to the error output such that we can check against this message
|
||||
// in the ASSERT_DEATH_IF_SUPPORTED below.
|
||||
fprintf(stderr, "Writing to %p.\n", write_address);
|
||||
fprintf(stderr, "Writing to code.\n");
|
||||
// This write will crash if code is protected.
|
||||
*write_address = 0;
|
||||
fprintf(stderr, "Successfully wrote to %p.\n", write_address);
|
||||
fprintf(stderr, "Successfully wrote to code.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,10 +316,19 @@ TEST_P(ParameterizedMemoryProtectionTestWithSignalHandling, TestSignalHandler) {
|
||||
pthread_kill(pthread_self(), SIGPROF);
|
||||
base::OS::Sleep(base::TimeDelta::FromMilliseconds(10));
|
||||
} while (uses_mprotect()), // Only loop for mprotect.
|
||||
// Check that the subprocess tried to write, but did not succeed.
|
||||
::testing::AllOf(
|
||||
::testing::HasSubstr("Writing to"),
|
||||
::testing::Not(::testing::HasSubstr("Successfully wrote"))));
|
||||
// Check that the subprocess tried to write, but did not succeed.
|
||||
#if V8_USE_ADDRESS_SANITIZER
|
||||
::testing::ContainsRegex(
|
||||
"Writing to code.\nAddressSanitizer:DEADLYSIGNAL"));
|
||||
#elif V8_USE_MEMORY_SANITIZER
|
||||
::testing::ContainsRegex(
|
||||
"Writing to code.\nMemorySanitizer:DEADLYSIGNAL"));
|
||||
#elif V8_USE_UNDEFINED_BEHAVIOR_SANITIZER
|
||||
::testing::ContainsRegex(
|
||||
"Writing to code.\nUndefinedBehaviorSanitizer:DEADLYSIGNAL"));
|
||||
#else
|
||||
::testing::EndsWith("Writing to code.\n"));
|
||||
#endif // V8_USE_ADDRESS_SANITIZER
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
} else {
|
||||
base::Optional<CodeSpaceWriteScope> write_scope;
|
||||
|
Loading…
Reference in New Issue
Block a user