[PATCH] D96626: Support: mapped_file_region: Pass MAP_NORESERVE to mmap
Sam McCall via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 17 08:30:17 PDT 2021
sammccall added a comment.
Sorry about the lack of response here.
Reading the docs, my understanding is MAP_NORESERVE on file-based mappings:
- is only relevant for writable mappings, read-only mappings should not fail on account of swap space in either case
- allows the mapping to succeed if there's not enough swap space to write it all, but if you actually write to too much of it, it will segfault
Is that about right?
If so, the risk is we're turning a handleable error_code into a crash. This might be the right tradeoff for a load coredump in LLDB (where we're very likely to open a huge file RW and then modify very little of it), but seems like a regression for other callers like FileOutputBuffer::create, in turn called by the LLD elf linker with a large filesize.
So this seems like it might not be safe in general, but if it were an option LLD might specify it.
Am I missing something?
(Re: Windows, my understanding matches yours, that we've got non-reserving behavior right now. But that doesn't tell us whether we consistency would be better achieved by adding SEC_COMMIT to the windows version. Confusingly, windows seems to use "commit" to refer to what unix calls "reserve", and SEC_RESERVE is something else).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96626/new/
https://reviews.llvm.org/D96626
More information about the llvm-commits
mailing list