[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
This commit is contained in:
Andrei Homescu 2023-07-25 15:25:50 +00:00 committed by Chia-hung Duan
parent bf89531c41
commit e4316a5997

View File

@ -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;
}