[compiler-rt] [compiler-rt][asan] _aligned_malloc/_aligned_free interception. (PR #82049)

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 06:34:23 PST 2025


zmodem wrote:

The test fails for me today as well, see below.

> Locally now I have this output (did check-compiler-rt but check-asan is faster)

First, are you sure that check-asan also runs TestCases/Windows/aligned_mallocs.cpp? If not, that could explain why you're not seeing the test failure.

Second, you seem to be hitting a bunch of other test failures, that I'm not seeing. What are the error messages for those?

It doesn't seem like a great use of time to review the patch if it's not even passing its own test.

---

```
********************
Testing:  0.. 10.. 20.. 30..
FAIL: AddressSanitizer-x86_64-windows :: TestCases/Windows/aligned_mallocs.cpp (476 of 2782)
******************** TEST 'AddressSanitizer-x86_64-windows :: TestCases/Windows/aligned_mallocs.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
C:/src/llvm-project/build/./bin/clang-cl.exe  -fsanitize=address -Wno-deprecated-declarations -WX -D_HAS_EXCEPTIONS=0 -gline-tables-only -gcodeview -gcolumn-info      -Od C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp -FeC:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp
# executed command: C:/src/llvm-project/build/./bin/clang-cl.exe -fsanitize=address -Wno-deprecated-declarations -WX -D_HAS_EXCEPTIONS=0 -gline-tables-only -gcodeview -gcolumn-info -Od 'C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp' '-FeC:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp'
# RUN: at line 2
not  C:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp 2>&1 | FileCheck C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp
# executed command: not 'C:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp'
# executed command: FileCheck 'C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp'
# .---command stderr------------
# | C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp:43:12: error: CHECK: expected string not found in input
# |  // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
# |            ^
# | <stdin>:1:1: note: scanning from here
# | =================================================================
# | ^
# | <stdin>:2:12: note: possible intended match here
# | ==87756==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000000000014 in thread T0
# |            ^
# |
# | Input file: <stdin>
# | Check file: C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# |             1: =================================================================
# | check:43'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |             2: ==87756==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000000000014 in thread T0
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:43'1                ?                                                                                                         possible intended match
# |             3:  #0 0x7ff910827486 in free C:\src\llvm-project\compiler-rt\lib\asan\asan_malloc_win.cpp:71
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             4:  #1 0x7ff617042643 in free C:\src\llvm-project\compiler-rt\lib\asan\asan_malloc_win_thunk.cpp:52
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             5:  #2 0x7ff6170539dd in _aligned_free_base minkernel\crts\ucrt\src\appcrt\heap\align.cpp:530
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             6:  #3 0x7ff6170539dd in _aligned_free minkernel\crts\ucrt\src\appcrt\heap\align.cpp:543
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             7:  #4 0x7ff617041266 in main C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp:37:3
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40
FAIL: AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/aligned_mallocs.cpp (524 of 2782)
******************** TEST 'AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/aligned_mallocs.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
C:/src/llvm-project/build/./bin/clang-cl.exe  -fsanitize=address -Wno-deprecated-declarations -WX -D_HAS_EXCEPTIONS=0 -gline-tables-only -gcodeview -gcolumn-info      -MD -Od C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp -FeC:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsDynamicConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp
# executed command: C:/src/llvm-project/build/./bin/clang-cl.exe -fsanitize=address -Wno-deprecated-declarations -WX -D_HAS_EXCEPTIONS=0 -gline-tables-only -gcodeview -gcolumn-info -MD -Od 'C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp' '-FeC:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsDynamicConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp'
# RUN: at line 2
not  C:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsDynamicConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp 2>&1 | FileCheck C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp
# executed command: not 'C:\src\llvm-project\build\projects\compiler-rt\test\asan\X86_64WindowsDynamicConfig\TestCases\Windows\Output\aligned_mallocs.cpp.tmp'
# executed command: FileCheck 'C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp'
# .---command stderr------------
# | C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp:43:12: error: CHECK: expected string not found in input
# |  // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
# |            ^
# | <stdin>:1:1: note: scanning from here
# | =================================================================
# | ^
# | <stdin>:2:17: note: possible intended match here
# | ==44208==ERROR: AddressSanitizer: access-violation on unknown address 0x11b03179ffa7 (pc 0x7ff7042a12f0 bp 0x000000000000 sp 0x007d242ffe00 T0)
# |                 ^
# |
# | Input file: <stdin>
# | Check file: C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# |             1: =================================================================
# | check:43'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |             2: ==44208==ERROR: AddressSanitizer: access-violation on unknown address 0x11b03179ffa7 (pc 0x7ff7042a12f0 bp 0x000000000000 sp 0x007d242ffe00 T0)
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:43'1                     ?                                                                                                                                possible intended match
# |             3: ==44208==The signal is caused by a WRITE memory access.
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             4:  #0 0x7ff7042a12ef in main C:\src\llvm-project\compiler-rt\test\asan\TestCases\Windows\aligned_mallocs.cpp:42:11
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             5:  #1 0x7ff7042a2653 in invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             6:  #2 0x7ff7042a2653 in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             7:  #3 0x7ff96e66259c (C:\WINDOWS\System32\KERNEL32.DLL+0x18001259c)
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--
```

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


More information about the llvm-commits mailing list