Change engine to always perform hashing on the signatures from the worker/runner. Previously, the runner does not really write signatures. The engine use the hash of the description as the fallback, then use the signature as part of file paths in the crash deduplication scheme. Now that engine worker (and runner in the future) writes the signature directly, we want to make sure that the signature is safe and suitable to use as file paths. Hashing the plain signatures seems the best way to do it. PiperOrigin-RevId: 979373269
diff --git a/centipede/centipede_callbacks.cc b/centipede/centipede_callbacks.cc index 38c84d6..c41e38a 100644 --- a/centipede/centipede_callbacks.cc +++ b/centipede/centipede_callbacks.cc
@@ -617,8 +617,9 @@ ReadFromLocalFile(failure_description_path_, batch_result.failure_description()); if (std::filesystem::exists(failure_signature_path_)) { - ReadFromLocalFile(failure_signature_path_, - batch_result.failure_signature()); + std::string plain_signature; + ReadFromLocalFile(failure_signature_path_, plain_signature); + batch_result.failure_signature() = Hash(plain_signature); } else { // Crash deduplication assumes that the failure signature contains no // dashes and that it can be used as a file name.
diff --git a/rust/e2e_tests/standalone_mode_test.rs b/rust/e2e_tests/standalone_mode_test.rs index f328388..2ca7acc 100644 --- a/rust/e2e_tests/standalone_mode_test.rs +++ b/rust/e2e_tests/standalone_mode_test.rs
@@ -98,7 +98,6 @@ // By default continue_after_crash is false, so finding a crash causes test failure. expect_false!(output.status.success()); expect_that!(stderr, matchers::contains_substring("Property function ran but crashed.")); - expect_that!(stderr, matchers::contains_regex("Signature[ \t]*: Unwinding panic")); // Centipede prefixes logs from the crashing worker with "CRASH LOG: ". expect_that!(stderr, matchers::contains_substring("CRASH LOG: Bug found!")); }
diff --git a/rust/e2e_tests/worker_with_centipede_sanitizer_test.rs b/rust/e2e_tests/worker_with_centipede_sanitizer_test.rs index b38196c..6ce859e 100644 --- a/rust/e2e_tests/worker_with_centipede_sanitizer_test.rs +++ b/rust/e2e_tests/worker_with_centipede_sanitizer_test.rs
@@ -38,7 +38,10 @@ let stderr = test_utils::run_centipede_with_args_expect_termination(fixture, &args); - expect_that!(stderr, matchers::contains_regex("Signature[ \t]*: heap-use-after-free")); + expect_that!( + stderr, + matchers::contains_substring("Property function ran but address sanitizer caught a bug") + ); } // TODO(yamilmorales): Enable this test on presubmit with --config=msan. @@ -59,5 +62,8 @@ let stderr = test_utils::run_centipede_with_args_expect_termination(fixture, &args); - expect_that!(stderr, matchers::contains_regex("Signature[ \t]*: Sanitizer crash")); + expect_that!( + stderr, + matchers::contains_substring("Property function ran but a sanitizer caught a bug") + ); }
diff --git a/rust/e2e_tests/worker_with_centipede_test.rs b/rust/e2e_tests/worker_with_centipede_test.rs index d76f4f9..eb6f637 100644 --- a/rust/e2e_tests/worker_with_centipede_test.rs +++ b/rust/e2e_tests/worker_with_centipede_test.rs
@@ -54,7 +54,6 @@ ); expect_that!(stderr, matchers::contains_substring("Property function ran but crashed.")); - expect_that!(stderr, matchers::contains_regex("Signature[ \t]*: Unwinding panic")); expect_that!(stderr, matchers::contains_substring("CRASH LOG: Bug found!")); }