[PATCH] D126343: [libunwind] Use process_vm_readv to avoid potential segfaults
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 16:20:59 PDT 2023
smeenai added a comment.
In D126343#4450731 <https://reviews.llvm.org/D126343#4450731>, @mpdenton wrote:
> The Chrome sandbox disallows process_vm_readv() (I think most seccomp sandboxes would) so this causes crashes when trying to collect backtraces at runtime.
>
> What would happen if I caused process_vm_read() to return EPERM here? Would the unwinder still be able to unwind past the sigreturn trampoline with heuristics?
>
> If not, is it possible to introduce a fallback that reads from the address directly, or possibly uses mincore() to check if the address is valid (a small race is possible)?
With the code as currently written, I believe we'd just fail to unwind past the sigreturn frame if `process_vm_readv` failed.
How would `mincore` work in this scenario? It tells you if a page is resident, but a non-resident page could still be accessible, right? On the flip side, `ENOMEM` would tell you if the page was unmapped, but an execute-only page would be mapped but still unreadable.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126343/new/
https://reviews.llvm.org/D126343
More information about the llvm-commits
mailing list