[PATCH] D126343: [libunwind] Use process_vm_readv to avoid potential segfaults

Matt Denton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 17:10:57 PDT 2023


mpdenton added a comment.

In D126343#4450750 <https://reviews.llvm.org/D126343#4450750>, @smeenai wrote:

> With the code as currently written, I believe we'd just fail to unwind past the sigreturn frame if `process_vm_readv` failed.

Ah, too bad.

> 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.

I didn't realize ARM supported execute-only pages. I was thinking that if mincore returned EFAULT  this would work to detect if an address was readable. It looks like a "write-to-pipe" works for checking if an address is readable: https://github.com/libunwind/libunwind/blob/0e9119698dfad47f8afb88c2a7ee3d36f9efd568/src/mi/Gaddress_validator.c#L97


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