[llvm-branch-commits] [compiler-rt] release/19.x: [sanitizer_common] Don't use syscall(SYS_clone) on Linux/sparc64 (#100534) (PR #101137)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Aug 10 02:49:52 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: None (llvmbot)

<details>
<summary>Changes</summary>

Backport 1c53b907bd6348138a59da270836fc9b4c161a07

Requested by: @<!-- -->rorth

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


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp (+6) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 1d6a55bdb7f385..50e41da68d959a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -826,10 +826,16 @@ uptr internal_sigaltstack(const void *ss, void *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }
 
+extern "C" pid_t __fork(void);
+
 int internal_fork() {
 #    if SANITIZER_LINUX
 #      if SANITIZER_S390
   return internal_syscall(SYSCALL(clone), 0, SIGCHLD);
+#      elif SANITIZER_SPARC
+  // The clone syscall interface on SPARC differs massively from the rest,
+  // so fall back to __fork.
+  return __fork();
 #      else
   return internal_syscall(SYSCALL(clone), SIGCHLD, 0);
 #      endif

``````````

</details>


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


More information about the llvm-branch-commits mailing list