This can happen on Myriad RTEMS so needs to be handled.
Details
- Reviewers
vitalybuka eugenis alekseyshl - Commits
- rG5a780ee9a91f: [asan, myriad] Use local pool for new/delete when ASan run-time is not up
rCRT334329: [asan, myriad] Use local pool for new/delete when ASan run-time is not up
rL334329: [asan, myriad] Use local pool for new/delete when ASan run-time is not up
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 19106 Build 19106: arc lint + arc unit
Event Timeline
Fix an issue after dropping a patch this depends on. This patch
should now stand on its own.
compiler-rt/lib/asan/asan_malloc_linux.cc | ||
---|---|---|
79 | IsFromLocalPool | |
compiler-rt/lib/asan/asan_malloc_local.h | ||
36 | I'd prefer to have this if in operator new and let the compiler to remove the code in non-rtems case. Maybe for the symmetry do this: #define ALLOCATE_FROM_LOCAL_POOL UNLIKELY(EarlyMalloc()) if (ALLOCATE_FROM_LOCAL_POOL) return MemalignFromLocalPool(alignment, size); You also probably want to die in !nothrow case if (ALLOCATE_FROM_LOCAL_POOL) { void *res = MemalignFromLocalPool(alignment, size); if (!nothrow) CHECK(res); return res; } | |
38 | How about calling it IS_FROM_LOCAL_POOL and have an explicit control flow in deletes: | |
compiler-rt/lib/asan/asan_new_delete.cc | ||
76 | Mimic our new behavior here, pass SHADOW_GRANULARITY as an alignment (and add a comment why). |
compiler-rt/lib/asan/asan_new_delete.cc | ||
---|---|---|
145 | It looks quite puzzling, let's add a parameter to the macro: if (IS_FROM_LOCAL_POOL(ptr)) |
This broke Windows debug builds where MemalignFromLocalPool becomes an unresolved external. (I guess in optimized builds the call within the if(0) gets optimized away.)
compiler-rt/lib/asan/asan_malloc_local.h | ||
---|---|---|
36 | I want to undo this change to put it in the operator new body because this code fails to link in debug builds on Windows, which I happened to do today. I'll send a review. |
compiler-rt/lib/asan/asan_malloc_local.h | ||
---|---|---|
36 |
Out of curiosity, did this end up happening? |
compiler-rt/lib/asan/asan_malloc_local.h | ||
---|---|---|
36 | Unfortunately, no, I didn't end up finding time to do it. Want to take a stab at it? |
IsFromLocalPool