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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Just a few questions.
compiler-rt/lib/scudo/standalone/primary32.h | ||
---|---|---|
877 | Is there a reason you don't make the ensurePageMapAllocated call before mark functions the same as in primary64.h? It's not immediately obvious why that's not possible. If you can pull it in front of these two calls, I would recommend removing the calls to ensurePageMapAllocated in both of the markXXX functions, replaced with a DCHECK(PageMap.isAllocated) call and leave the functions returning void. |
compiler-rt/lib/scudo/standalone/primary32.h | ||
---|---|---|
877 | In Primary64, we have determined which memory groups will release so that we can prepare the page map in advance. In Primary32, we don't exam all the memory groups first to determine the groups to release, so we still have the chance of not releasing any group (i.e., don't need the page map). The reason we haven't implemented this in primary32 is the logic is a little bit more complicated than primary64 because of multiple regions. Therefore, we didn't implement this in the same CL when we brought partial release in primary64 And yes, I agree that if both allocators apply the same strategy, we can remove theuse of ensurePageMapAllocated(). |
Is there a reason you don't make the ensurePageMapAllocated call before mark functions the same as in primary64.h?
It's not immediately obvious why that's not possible.
If you can pull it in front of these two calls, I would recommend removing the calls to ensurePageMapAllocated in both of the markXXX functions, replaced with a DCHECK(PageMap.isAllocated) call and leave the functions returning void.