15 Commits

Author SHA1 Message Date
Marco Elver
175fcd6fd2 [compiler-rt] Simplify ALIAS() attribute macro
Most uses of ALIAS() are in conjunction with WRAPPER_NAME().

Simplify the code and just make ALIAS() turn its argument into a string
(similar to Linux kernel's __alias macro). This in turn allows removing
WRAPPER_NAME().

NFC.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D151216
2023-05-24 11:57:17 +02:00
Leonard Chan
6680d4e42f "Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
This reverts commit cdf71d2ccd84ed7b8891924b04d1603f344038e9.

Relanding this because this only affects fuchsia builders and we moved
our hwasan builders to a non-blocking pool in the meantime.
2023-04-18 18:26:01 +00:00
Leonard Chan
cdf71d2ccd Revert ""Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia""
This reverts commit 39ece7583a784976dea786d59e6564649b13d92d.

Reverting because I suspect this is leading to the failures we see in
fxbug.dev/125426. We're seeing unexpected OOMs and I suspect it's
because this change makes c-style allocation functions use hwasan's
allocator which might be worse than the default one (scudo). Reverting
for now to see if this unblocks the clang roll.
2023-04-14 22:31:09 +00:00
Leonard Chan
39ece7583a "Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
This reverts commit 7b6c0ce9c6c1e2cc3076e787e0e8d9a43bc2bfcc.

See if this works on the android builder this time by keeping the
original WRAP declaration.
2023-03-31 17:11:26 +00:00
Leonard Chan
7b6c0ce9c6 Revert ""Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia""
This reverts commit 1190a1dbd54d8af074e9d4986c7f9cad5c0037f3.

This probably broke
https://lab.llvm.org/buildbot/#/builders/77/builds/26043/steps/21/logs/stdio
again.
2023-03-31 00:08:02 +00:00
Leonard Chan
1190a1dbd5 "Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
This reverts commit c5c6781428a70d1fffd00a256a237cbf5a3ccfd3.

This likely broke the android sanitizer builders prior because it
accidentally enabled interceptors for android, which they don't use, so
c-allocation functions like malloc would go through hwasan.

This reland adds the HWASAN_WITH_INTERCEPTORS check.
2023-03-30 19:59:54 +00:00
Leonard Chan
c5c6781428 Revert "Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
This reverts commit 5bb826d569ccd80e28aedd682db39b8cddd44e53.

We suspect this is leading to the segfaults for tests run on
aarch64+android+hwasan:
https://lab.llvm.org/buildbot/#/builders/77/builds/26025/steps/21/logs/stdio
2023-03-30 01:38:05 +00:00
Leonard Chan
5bb826d569 Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia
This reverts commit 3b4cb1e96c645bb833fe710856479c31383859bb.

Reland D145718 but unconditionally define __sanitizer_mallinfo which is
exposed as part of the hwasan interface.

Differential Revision: https://reviews.llvm.org/D145718
2023-03-29 17:34:16 +00:00
Vitaly Buka
3b4cb1e96c Revert "[hwasan] Provide aliases for c allocation functions for Fuchsia"
Breaks build bots, details in D145718.

This reverts commit 7de775159660538449652ca442c34fd91feecef6.
2023-03-10 21:18:25 -08:00
Leonard Chan
7de7751596 [hwasan] Provide aliases for c allocation functions for Fuchsia
"Interceptors" in this file aren't like the traditional interceptors
used by other sanitizers like asan. They're simply aliases to the
equivalent __sanitizer_* functions.

This also removes the WRAP(FN) declaration since it just creates
declarations for __interceptor_* functions but they seem to be unused.

Differential Revision: https://reviews.llvm.org/D145718
2023-03-11 00:31:04 +00:00
Leonard Chan
ca0fab0c36 [hwasan] Suppress leaks from dlsym with hwasan+lsan just like with
asan+lsan

We should follow suite with how asan handles this now that lsan also
works with hwasan.

Differential Revision: https://reviews.llvm.org/D145613
2023-03-09 21:42:04 +00:00
Vitaly Buka
cb0e14ce6d [sanitizer] Switch dlsym hack to internal_allocator
Since glibc 2.34, dlsym does
  1. malloc 1
  2. malloc 2
  3. free pointer from malloc 1
  4. free pointer from malloc 2
These sequence was not handled by trivial dlsym hack.

This fixes https://bugs.llvm.org/show_bug.cgi?id=52278

Reviewed By: eugenis, morehouse

Differential Revision: https://reviews.llvm.org/D112588
2021-11-12 16:11:10 -08:00
Vitaly Buka
651797f488 [NFC][sanitizer] Move GET_MALLOC_STACK_TRACE closer to the use 2021-11-10 15:42:07 -08:00
Leonard Chan
b4c00b3882 [compiler-rt][hwasan] Remove __sanitizer allocation functions from hwasan interface
These functions should not be externally used. We also do not need them internally for Fuchsia.

Differential Revision: https://reviews.llvm.org/D99381
2021-07-30 11:37:19 -07:00
Leonard Chan
944b3c53ae [NFC][compiler-rt][hwasan] Move allocation functions into their own file
This removes the `__sanitizer_*` allocation function definitions from
`hwasan_interceptors.cpp` and moves them into their own file. This way
implementations that do not use interceptors at all can just ignore
(almost) everything in `hwasan_interceptors.cpp`.

Also remove some unused headers in `hwasan_interceptors.cpp` after the move.

Differential Revision: https://reviews.llvm.org/D103564
2021-06-08 12:08:23 -07:00