[compiler-rt] [sanitizer] Print diagnostic if ptrace syscall fails (PR #151406)
Thurston Dang via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 12:59:24 PDT 2025
================
@@ -403,7 +403,51 @@ struct ScopedSetTracerPID {
}
};
+// This detects whether ptrace is blocked (e.g., by seccomp), by forking and
+// then attempting ptrace.
+// This separate check is necessary because StopTheWorld() creates a *thread*,
+// and therefore cannot use waitpid() due to the shared errno.
+static void TestPTrace() {
+ // Only check the first time this is called.
+ static bool checked = false;
+ if (checked)
+ return;
+ checked = true;
+
+ // fork() should be cheap because of copy-on-write. Besides, this is only
----------------
thurstond wrote:
Reworded
https://github.com/llvm/llvm-project/pull/151406
More information about the llvm-commits
mailing list