Skip to content

[sanitizer] Downgrade TestPTrace() Reports to VReport #152350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thurstond
Copy link
Contributor

Requested in #152072 (comment)

@llvmbot
Copy link
Member

llvmbot commented Aug 6, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Thurston Dang (thurstond)

Changes

Requested in #152072 (comment)


Full diff: https://github.com/llvm/llvm-project/pull/152350.diff

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp (+7-6)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
index 5fde65ea48c42..2bf547f4a7216 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
@@ -413,11 +413,12 @@ static void TestPTrace() {
   // internal_fork() on SPARC actually calls __fork(). We can't safely fork,
   // because it's possible seccomp has been configured to disallow fork() but
   // allow clone().
-  Report("WARNING: skipping TestPTrace() because this is SPARC\n");
-  Report(
-      "If seccomp blocks ptrace, LeakSanitizer may hang without further "
-      "notice\n");
-  Report(
+  VReport(1, "WARNING: skipping TestPTrace() because this is SPARC\n");
+  VReport(1,
+          "If seccomp blocks ptrace, LeakSanitizer may hang without further "
+          "notice\n");
+  VReport(
+      1,
       "If seccomp does not block ptrace, you can safely ignore this warning\n");
 #  else
   // Heuristic: only check the first time this is called. This is not always
@@ -438,7 +439,7 @@ static void TestPTrace() {
   if (pid < 0) {
     int rverrno;
     if (internal_iserror(pid, &rverrno))
-      Report("WARNING: TestPTrace() failed to fork (errno %d)\n", rverrno);
+      VReport(0, "WARNING: TestPTrace() failed to fork (errno %d)\n", rverrno);
 
     // We don't abort the sanitizer - it's still worth letting the sanitizer
     // try.

"If seccomp blocks ptrace, LeakSanitizer may hang without further "
"notice\n");
Report(
VReport(1, "WARNING: skipping TestPTrace() because this is SPARC\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we only run this function if verbose logging is on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-SPARC case has logging for verbosity >= 0. It would be ugly to add an extra check for verbosity only for SPARC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, this function is only called once (for leak detection at the end of the program execution); it's rare for users to manually trigger leak detection. In any case, the overhead of calling this function is low compared to the rest of leak detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants