[compiler-rt] [asan] Plumb may_return_null through asan_memalign (PR #196413)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun May 31 17:43:49 PDT 2026


================
@@ -673,16 +676,23 @@ struct Allocator {
     atomic_store(&m->chunk_state, CHUNK_ALLOCATED, memory_order_release);
     if (alloc_beg != chunk_beg) {
       CHECK_LE(alloc_beg + sizeof(LargeChunkHeader), chunk_beg);
-      reinterpret_cast<LargeChunkHeader *>(alloc_beg)->Set(m);
+      reinterpret_cast<LargeChunkHeader*>(alloc_beg)->Set(m);
     }
     RunMallocHooks(res, size);
     return res;
   }
 
+  // Defer to the global, flag controlled, OOM policy.
+  void* Allocate(uptr size, uptr alignment, BufferedStackTrace* stack,
+                 AllocType alloc_type, bool can_fill) {
+    return AllocateImpl(size, alignment, stack, alloc_type, can_fill,
+                        AllocatorMayReturnNull());
----------------
vitalybuka wrote:

Can you set here constant true/false  and read flag inside of AllocateImpl only on error, so as is it will be inlined into existing version

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


More information about the llvm-commits mailing list