[compiler-rt] [asan] Implement interception on AIX (PR #131870)
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 22:03:42 PST 2025
================
@@ -781,11 +781,17 @@ struct Allocator {
u8 chunk_state = atomic_load(&m->chunk_state, memory_order_acquire);
if (chunk_state != CHUNK_ALLOCATED)
ReportInvalidFree(old_ptr, chunk_state, stack);
- CHECK_NE(REAL(memcpy), nullptr);
uptr memcpy_size = Min(new_size, m->UsedSize());
// If realloc() races with free(), we may start copying freed memory.
// However, we will report racy double-free later anyway.
+#if !SANITIZER_AIX
+ CHECK_NE(REAL(memcpy), nullptr);
REAL(memcpy)(new_ptr, old_ptr, memcpy_size);
+#else
+ // AIX currently can't retrieve memcpy's address, we have to use
+ // internal_memcpy here.
----------------
hubert-reinterpretcast wrote:
The comment as written is misleading: it implies that being unable to retrieve an address for the real `memcpy` as a member of a shared library (which, afaik, is not something that we plan to change) necessarily means that we have to use `internal_memcpy` (i.e., there are no other options).
Perhaps change this comment to reflect any future plans to use `___memcpy` on AIX? Better yet: Update this PR to make use of `___memcpy` (which is what the `memcpy` wrapper that AIX `libc` provides for static linking forwards to).
https://github.com/llvm/llvm-project/pull/131870
More information about the llvm-commits
mailing list