diff options
author | Jake Egan <Jake.egan@ibm.com> | 2025-06-25 11:18:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-25 11:18:15 -0400 |
commit | 287b24e1899eb6ce62eb9daef5a24faae5e66c1e (patch) | |
tree | 4d9ad128b69f53dbf5ff8d20c3ce45691d1f0c5c | |
parent | ea1e18157133422175bd47778c4e5b7dfc306688 (diff) | |
download | llvm-287b24e1899eb6ce62eb9daef5a24faae5e66c1e.zip llvm-287b24e1899eb6ce62eb9daef5a24faae5e66c1e.tar.gz llvm-287b24e1899eb6ce62eb9daef5a24faae5e66c1e.tar.bz2 |
[asan] Implement address sanitizer on AIX: address descriptions (#138891)
Adapt address description logic for AIX.
Issue: https://github.com/llvm/llvm-project/issues/138916
-rw-r--r-- | compiler-rt/lib/asan/asan_descriptions.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/compiler-rt/lib/asan/asan_descriptions.cpp b/compiler-rt/lib/asan/asan_descriptions.cpp index c9f3e4d..0c30959 100644 --- a/compiler-rt/lib/asan/asan_descriptions.cpp +++ b/compiler-rt/lib/asan/asan_descriptions.cpp @@ -211,10 +211,10 @@ bool GetStackAddressInformation(uptr addr, uptr access_size, descr->frame_pc = access.frame_pc; descr->frame_descr = access.frame_descr; -#if SANITIZER_PPC64V1 - // On PowerPC64 ELFv1, the address of a function actually points to a - // three-doubleword data structure with the first field containing - // the address of the function's code. +#if SANITIZER_PPC64V1 || SANITIZER_AIX + // On PowerPC64 ELFv1 or AIX, the address of a function actually points to a + // three-doubleword (or three-word for 32-bit AIX) data structure with + // the first field containing the address of the function's code. descr->frame_pc = *reinterpret_cast<uptr *>(descr->frame_pc); #endif descr->frame_pc += 16; @@ -444,6 +444,16 @@ AddressDescription::AddressDescription(uptr addr, uptr access_size, data.kind = kAddressKindShadow; return; } + + // Check global first. On AIX, some global data defined in shared libraries + // are put to the STACK region for unknown reasons. Check global first can + // workaround this issue. + // TODO: Look into whether there's a different solution to this problem. + if (GetGlobalAddressInformation(addr, access_size, &data.global)) { + data.kind = kAddressKindGlobal; + return; + } + if (GetHeapAddressInformation(addr, access_size, &data.heap)) { data.kind = kAddressKindHeap; return; @@ -461,10 +471,6 @@ AddressDescription::AddressDescription(uptr addr, uptr access_size, return; } - if (GetGlobalAddressInformation(addr, access_size, &data.global)) { - data.kind = kAddressKindGlobal; - return; - } data.kind = kAddressKindWild; data.wild.addr = addr; data.wild.access_size = access_size; |