[all-commits] [llvm/llvm-project] 2e6da8: [compiler-rt][asan] Reland: wcscpy/wcsncpy interce...

Yixuan Cao via All-commits all-commits at lists.llvm.org
Sun Oct 5 18:03:33 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e6da800484d9cf5a75a9a57919f855d7de70d42
      https://github.com/llvm/llvm-project/commit/2e6da800484d9cf5a75a9a57919f855d7de70d42
  Author: Yixuan Cao <caoyixuan2019 at email.szu.edu.cn>
  Date:   2025-10-05 (Sun, 05 Oct 2025)

  Changed paths:
    M compiler-rt/lib/asan/asan_interceptors.cpp
    M compiler-rt/lib/asan/asan_interceptors.h
    M compiler-rt/lib/asan/asan_win_static_runtime_thunk.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
    A compiler-rt/test/asan/TestCases/wcscat.cpp
    A compiler-rt/test/asan/TestCases/wcscpy.cpp
    A compiler-rt/test/asan/TestCases/wcsncat.cpp
    A compiler-rt/test/asan/TestCases/wcsncpy.cpp

  Log Message:
  -----------
  [compiler-rt][asan] Reland: wcscpy/wcsncpy interceptors and stabilize wchar tests on Darwin/Android (#162028)

### Summary
Reland: wcscpy/wcsncpy interceptors and stabilize wchar tests on
Darwin/Android. Functional reland (runtime + tests).

### Context
Reland of #160493 and #161624; previously reverted by #162021 and
#162001 to restore green.

### Motivation
- Restore wchar interceptors (wcscpy/wcsncpy), broaden ASan coverage,
and improve Windows parity with narrow-string checks.
- Make tests robust across Darwin/Android to keep bots green.

### Runtime (wcscpy/wcsncpy)
- Add overlap checks; mark read/write ranges in bytes.
- Use MaybeRealWcsnlen when available to bound reads.
- Register Windows static runtime thunk where applicable.

### Tests (wcscpy/wcsncpy/wcscat/wcsncat)
- Android: keep `%env_asan_opts=log_to_stderr=1` so the ASan header is
on stderr.
- Darwin: tolerate reordering by putting all four key lines in one DAG
group:

```cpp
// CHECK-DAG: Good so far.
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:...]] at pc {{...}} bp {{...}} sp {{...}}
// CHECK-DAG: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
// CHECK-DAG: #0 {{0x[0-9a-f]+}} in <func>
```

### Risk
- Functional reland (runtime + tests), intended to restore functionality
and maintain stability across platforms.

---------

Signed-off-by: Yixuan Cao <caoyixuan2019 at email.szu.edu.cn>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list