[compiler-rt] [llvm] [msan] Add interceptors for fortified memory functions (__memcpy_chk, etc.) (PR #206702)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 13:59:47 PDT 2026


================
@@ -1822,6 +1905,10 @@ void InitializeInterceptors() {
   MSAN_MAYBE_INTERCEPT_FREAD_UNLOCKED;
   INTERCEPT_FUNCTION(memccpy);
   MSAN_MAYBE_INTERCEPT_MEMPCPY;
+  MSAN_MAYBE_INTERCEPT___MEMCPY_CHK;
----------------
vitalybuka wrote:

Msan declares
```
#define COMMON_INTERCEPTOR_MEMSET_IMPL(ctx, block, c, size) \
  {                                                         \
    (void)ctx;                                              \
    return __msan_memset(block, c, size);                   \
  }
#define COMMON_INTERCEPTOR_MEMMOVE_IMPL(ctx, to, from, size) \
  {                                                          \
    (void)ctx;                                               \
    return __msan_memmove(to, from, size);                   \
  }
#define COMMON_INTERCEPTOR_MEMCPY_IMPL(ctx, to, from, size) \
  {                                                         \
    (void)ctx;                                              \
    return __msan_memcpy(to, from, size);                   \
  }
```

and sanitizer_common_interceptors_memintrinsics.inc installs them

I think we should do the same for "chk" versions.

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


More information about the llvm-commits mailing list