[compiler-rt] 061426d - [sanitizer] Fix vfork interception on loongarch64
Weining Lu via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 2 20:09:23 PDT 2022
Author: Xi Ruoyao
Date: 2022-11-03T11:08:15+08:00
New Revision: 061426df572552bc839e1a80cb29070d4242a32f
URL: https://github.com/llvm/llvm-project/commit/061426df572552bc839e1a80cb29070d4242a32f
DIFF: https://github.com/llvm/llvm-project/commit/061426df572552bc839e1a80cb29070d4242a32f.diff
LOG: [sanitizer] Fix vfork interception on loongarch64
Fix a brown paper bag error made by me in D129418. I didn't set
ASAN_INTERCEPT_VFORK correctly for loongarch64, but created an all-zero
object for __interception::real_vfork. This caused anything calling
vfork() to die instantly.
Fix this issue by setting ASAN_INTERCEPT_VFORK and remove the bad
all-zero definition. Other ports have an all-zero common definition but
we don't need it at least for now.
And, enable ASAN vfork test for loongarch64 to prevent regression in the
future.
Differential Revision: https://reviews.llvm.org/D137160
Added:
Modified:
compiler-rt/lib/asan/asan_interceptors.h
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S
compiler-rt/test/asan/TestCases/Linux/vfork.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_interceptors.h b/compiler-rt/lib/asan/asan_interceptors.h
index 35727a96497dc..c4bf087ea17f0 100644
--- a/compiler-rt/lib/asan/asan_interceptors.h
+++ b/compiler-rt/lib/asan/asan_interceptors.h
@@ -114,7 +114,7 @@ void InitializePlatformInterceptors();
#if SANITIZER_LINUX && \
(defined(__arm__) || defined(__aarch64__) || defined(__i386__) || \
- defined(__x86_64__) || SANITIZER_RISCV64)
+ defined(__x86_64__) || SANITIZER_RISCV64 || SANITIZER_LOONGARCH64)
# define ASAN_INTERCEPT_VFORK 1
#else
# define ASAN_INTERCEPT_VFORK 0
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S
index 05192485d5971..68782acb379d1 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S
@@ -5,12 +5,6 @@
ASM_HIDDEN(COMMON_INTERCEPTOR_SPILL_AREA)
ASM_HIDDEN(_ZN14__interception10real_vforkE)
-.bss
-.type _ZN14__interception10real_vforkE, @object
-.size _ZN14__interception10real_vforkE, 8
-_ZN14__interception10real_vforkE:
- .zero 8
-
.text
.globl ASM_WRAPPER_NAME(vfork)
ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
diff --git a/compiler-rt/test/asan/TestCases/Linux/vfork.cpp b/compiler-rt/test/asan/TestCases/Linux/vfork.cpp
index 4c0f02c5088e4..b943e4debce2c 100644
--- a/compiler-rt/test/asan/TestCases/Linux/vfork.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/vfork.cpp
@@ -1,7 +1,7 @@
// https://github.com/google/sanitizers/issues/925
// RUN: %clang_asan -O0 %s -o %t && %run %t 2>&1
-// REQUIRES: aarch64-target-arch || x86_64-target-arch || i386-target-arch || arm-target-arch || riscv64-target-arch
+// REQUIRES: aarch64-target-arch || x86_64-target-arch || i386-target-arch || arm-target-arch || riscv64-target-arch || loongarch64-target-arch
#include <assert.h>
#include <sys/types.h>
More information about the llvm-commits
mailing list