[libunwind] Use process_vm_readv to avoid potential segfaults
authorShoaib Meenai <smeenai@fb.com>
Thu, 26 May 2022 04:39:12 +0000 (21:39 -0700)
committerShoaib Meenai <smeenai@fb.com>
Thu, 26 May 2022 16:12:51 +0000 (09:12 -0700)
commit0be0a53df65cb402359c257922d80ab93d86fb40
tree0e12f091edf7840f256c4bd67ebd82a3283a84ee
parent3d2b5b7b87857b0cc4c322cfc145c46c42fe2bbf
[libunwind] Use process_vm_readv to avoid potential segfaults

We've observed segfaults in libunwind when attempting to check for the
Linux aarch64 sigreturn frame, presumably because of bad unwind info
leading to an incorrect PC that we attempt to read from. Use
process_vm_readv to read the memory safely instead.

The s390x code path should likely follow suit, but I don't have the
hardware to be able to test that, so I didn't modify it here either.

Reviewed By: MaskRay, rprichard, #libunwind

Differential Revision: https://reviews.llvm.org/D126343
libunwind/src/UnwindCursor.hpp
libunwind/test/bad_unwind_info.pass.cpp [new file with mode: 0644]