[PATCH] D50940: [sanitizer] Change Mmap*NoAccess to return MMAP_FAILED (~(uptr)0) on error
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 10:46:49 PDT 2018
cryptoad added a comment.
I guess after scavenging further, my initial patch is not correct, as other functions return nullptr on failure.
I am open to anything if we can get a consensus on what should be returned.
Here is the current state:
MmapOrDie: pointer or death
MmapOrDieOnFatalError: pointer, nullptr, or death
MmapAlignedOrDieOnFatalError: pointer, nullptr, or death
MmapNoReserveOrDie: pointer or death
MmapFixedImpl: pointer, nullptr, or death
MmapNoAccess: syscall return value (eg: pointer or -error) [on Windows it returns the result of VirtualAlloc which is NULL on failure)
MmapFixedNoAccess: syscall return value (eg: pointer or -error) [same as above for Windows]
The current wrong usage:
__sanitizer::SizeClassAllocator64::Init: checks for failure with ~(uptr)0 (while it's the syscall return value)
__sanitizer::LargeMmapAllocatorPtrDynamicArray::Init: checks for failure with nullptr (while it's the syscall return value)
__scudo::LargeMmapAllocator::Allocate: checks for failure with ~(uptr)0 (while it's the syscall return value)
__xray::profileCollectorService::allocateBuffer: checks for failure with MMAP_FAILED (while it's the syscall return value)
same with __xray::Allocator::Alloc & alocRaw
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D50940
More information about the llvm-commits
mailing list