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

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 08:05:55 PST 2024


================
@@ -33,6 +33,14 @@ int test_function() {
     return __LINE__;
   _aligned_free(p);
 
+  char *y = (char *)malloc(1024);
+  char *u = (char *)realloc(y, 2048);
+  u[0] = 'a';
+  _aligned_free(u);
+  // CHECK: AddressSanitizer: attempting free on address which was not malloc()-ed: [[ADDR]] in thread T0
+  u = (char *)_aligned_offset_malloc(1024, 8, 2);
+  _aligned_free(u);
+
----------------
zmodem wrote:

> what do you suggest to fix the linkage issue ?

I'm not sure why I didn't see it before, and I'm also not sure why we get link error for these _aligned functions, but not regular malloc etc. Maybe they're declared different in the CRT somehow.

But perhaps for the static thunk, we need to intercept these functions in asan_win_static_runtime_thunk.cpp instead.

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


More information about the llvm-commits mailing list