[all-commits] [llvm/llvm-project] 2dc226: [ASan] Honor `allocator_may_return_null` when set ...
David Justo via All-commits
all-commits at lists.llvm.org
Wed Dec 11 01:21:57 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2dc22615fd46ab2566d0f26d5ba234ab12dc4bf8
https://github.com/llvm/llvm-project/commit/2dc22615fd46ab2566d0f26d5ba234ab12dc4bf8
Author: David Justo <david.justo.1996 at gmail.com>
Date: 2024-12-11 (Wed, 11 Dec 2024)
Changed paths:
M compiler-rt/lib/asan/asan_flags.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
A compiler-rt/test/asan/TestCases/Windows/allocator_may_return_null_limits.cpp
Log Message:
-----------
[ASan] Honor `allocator_may_return_null` when set through user-function and fix large alloc edge case (#117929)
**Related:** #117925
**About this PR:**
This PR performs 3 small but related fixes for ASan users on Windows:
1. It ensures that the `allocator_may_return_null` flag is honored when
set through the user function `__asan_default_options`. For more
details, please see: #117925
2. It adds a missing `AllocatorMayReturnNull()` check inside
`InternalAlloc` that's needed to avoid error'ing out when the allocator
_correctly_ returns `null` when `allocator_may_return_null` is set.
3. In `sanitizer_win`'s `ReturnNullptrOnOOMOrDie`, it allows returning
`null` when the last error is set to `ERROR_INVALID_PARAMETER` which may
be set by `VirtualAlloc` on WIndows when attempting to allocate
exceedingly large memory.
I've added test cases that should cover these new behaviors. Happy to
take on any feedback as well. Thank you :-)
---------
Co-authored-by: David Justo <dajusto at microsoft.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list