[scudo] releaseToOSMaybe can fail if it can't allocate PageMap
authorChia-hung Duan <chiahungduan@google.com>
Thu, 25 May 2023 17:36:10 +0000 (17:36 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Thu, 25 May 2023 18:07:55 +0000 (18:07 +0000)
commit11ea40cff5413057d823a4b3ac5ac419b674dc56
tree2a434921642c0343c656c92e6931b17a8280d002
parent8cdbf8d3e7b88da376a09a58ddd1fcc00cf30bb2
[scudo] releaseToOSMaybe can fail if it can't allocate PageMap

PageMap is allocated with MAP_ALLOWNOMEM if there's no static buffer
left. So it can be failed and return nullptr without any assertion
triggered. Instead of crashing in the releaseToOSMaybe in the middle,
just return and let the program handles the page failure.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D151379
compiler-rt/lib/scudo/standalone/primary32.h
compiler-rt/lib/scudo/standalone/primary64.h
compiler-rt/lib/scudo/standalone/release.h
compiler-rt/lib/scudo/standalone/tests/release_test.cpp