[compiler-rt] [sanitizer] Pre-commit disabled test for fork (PR #75257)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 16:16:06 PST 2023


================
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: *
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include <assert.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
----------------
fmayer wrote:

Not immediately clear why this can deadlock.

https://github.com/llvm/llvm-project/pull/75257


More information about the llvm-commits mailing list