[compiler-rt] e4316a5 - [scudo] Return NULL when MAP_ALLOWNOMEM is set on Trusty

Chia-hung Duan via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 08:29:49 PDT 2023


Author: Andrei Homescu
Date: 2023-07-25T15:25:50Z
New Revision: e4316a599727332a2332b89d28d40509d2c96ce0

URL: https://github.com/llvm/llvm-project/commit/e4316a599727332a2332b89d28d40509d2c96ce0
DIFF: https://github.com/llvm/llvm-project/commit/e4316a599727332a2332b89d28d40509d2c96ce0.diff

LOG: [scudo] Return NULL when MAP_ALLOWNOMEM is set on Trusty

Back-ported from https://r.android.com/2591905.

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D155144

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/trusty.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/trusty.cpp b/compiler-rt/lib/scudo/standalone/trusty.cpp
index 3191091e1b965b..5f72b1cb3e54b0 100644
--- a/compiler-rt/lib/scudo/standalone/trusty.cpp
+++ b/compiler-rt/lib/scudo/standalone/trusty.cpp
@@ -50,7 +50,8 @@ void *map(void *Addr, uptr Size, const char *Name, uptr Flags,
 
   if (IS_ERR(P)) {
     errno = lk_err_to_errno(PTR_ERR(P));
-    dieOnMapUnmapError(Size);
+    if (!(Flags & MAP_ALLOWNOMEM) || errno != ENOMEM)
+      dieOnMapUnmapError(Size);
     return nullptr;
   }
 


        


More information about the llvm-commits mailing list