[all-commits] [llvm/llvm-project] 77d81c: [libc] Fix msan/asan memcpy reentrancy

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Tue Mar 30 08:29:11 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77d81c2270c6221a430aac17c2c0aa73b39cc0d2
      https://github.com/llvm/llvm-project/commit/77d81c2270c6221a430aac17c2c0aa73b39cc0d2
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M libc/src/__support/CMakeLists.txt
    A libc/src/__support/sanitizer.h
    R libc/src/__support/sanitizer_annotations.h
    M libc/src/string/memory_utils/memcpy_utils.h
    M libc/utils/FPUtil/x86_64/FEnv.h

  Log Message:
  -----------
  [libc] Fix msan/asan memcpy reentrancy

This is needed to prevent asan/msan instrumentation to redirect CopyBlock to `__asan_memcpy` (resp. `__msan_memcpy`).
These functions would then differ operation to `memcpy` which leads to reentrancy issues.

With this patch, `memcpy` is fully instrumented and covered by asan/msan.

If this turns out to be too expensive, instrumentation can be selectively or fully disabled through the use of the `__attribute__((no_sanitize(address, memory)))` annotation.

Differential Revision: https://reviews.llvm.org/D99598




More information about the All-commits mailing list