[compiler-rt] Revert "[compiler-rt][sanitizer-common] adding C23 memset_explicit interception." (PR #157317)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 6 14:47:21 PDT 2025


https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/157317

Reverts llvm/llvm-project#154428 due to buildbot breakages (e.g., https://lab.llvm.org/buildbot/#/builders/51/builds/22984)

>From 7aec0dac3a3bf938c1412cf46f03a8a0fbce023c Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston.dang at gmail.com>
Date: Sat, 6 Sep 2025 14:46:37 -0700
Subject: [PATCH] =?UTF-8?q?Revert=20"[compiler-rt][sanitizer-common]=20add?=
 =?UTF-8?q?ing=20C23=20memset=5Fexplicit=20intercepti=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 7e55a4c9937dfc2184636ad7f3c9f7eccfad6186.
---
 .../sanitizer_common_interceptors_memintrinsics.inc | 11 -----------
 .../sanitizer_platform_interceptors.h               |  4 +---
 .../TestCases/Linux/memset_explicit.c               | 13 -------------
 3 files changed, 1 insertion(+), 27 deletions(-)
 delete mode 100644 compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc
index 5334b0ded17e8..0b6731c89950b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc
@@ -233,16 +233,6 @@ INTERCEPTOR(void *, bzero, void *block, usize size) {
 #define INIT_BZERO
 #endif  // SANITIZER_INTERCEPT_BZERO
 
-#if SANITIZER_INTERCEPT_MEMSET_EXPLICIT
-INTERCEPTOR(void *, memset_explicit, void *block, int c, usize size) {
-  void *ctx;
-  COMMON_INTERCEPTOR_MEMSET_IMPL(ctx, block, c, size);
-}
-#define INIT_MEMSET_EXPLICIT COMMON_INTERCEPT_FUNCTION(memset_explicit)
-#else
-#define INIT_MEMSET_EXPLICIT
-#endif
-
 namespace __sanitizer {
 // This does not need to be called if InitializeCommonInterceptors() is called.
 void InitializeMemintrinsicInterceptors() {
@@ -252,6 +242,5 @@ void InitializeMemintrinsicInterceptors() {
   INIT_AEABI_MEM;
   INIT___BZERO;
   INIT_BZERO;
-  INIT_MEMSET_EXPLICIT;
 }
 }  // namespace __sanitizer
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index eee7af2069694..29987decdff45 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -663,17 +663,15 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
 #define SANITIZER_INTERCEPT_GETSERVBYNAME_R SI_GLIBC
 #define SANITIZER_INTERCEPT_GETSERVBYPORT_R SI_GLIBC
 
-// Until free_sized, free_aligned_sized and memset_explicit are more generally available,
+// Until free_sized and free_aligned_sized are more generally available,
 // we can only unconditionally intercept on ELF-based platforms where it
 // is okay to have undefined weak symbols.
 #ifdef __ELF__
 #  define SANITIZER_INTERCEPT_FREE_SIZED 1
 #  define SANITIZER_INTERCEPT_FREE_ALIGNED_SIZED 1
-#  define SANITIZER_INTERCEPT_MEMSET_EXPLICIT 1
 #else
 #  define SANITIZER_INTERCEPT_FREE_SIZED 0
 #  define SANITIZER_INTERCEPT_FREE_ALIGNED_SIZED 0
-#  define SANITIZER_INTERCEPT_MEMSET_EXPLICIT 0
 #endif
 
 // This macro gives a way for downstream users to override the above
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c b/compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c
deleted file mode 100644
index 4714ea51f25de..0000000000000
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clang -std=c23 -O0 %s -o %t && %run %t
-// UNSUPPORTED: asan, lsan, hwasan, ubsan
-
-#include <stddef.h>
-#include <stdlib.h>
-
-extern void *memset_explicit(void *p, int value, size_t size);
-
-int main() {
-  char secbuffer[64];
-  (void)memset_explicit(secbuffer, 0, sizeof(secbuffer));
-  return 0;
-}



More information about the llvm-commits mailing list