[libcxx-commits] [PATCH] D129856: [libunwind][SystemZ] Use process_vm_readv to avoid potential segfaults

Shoaib Meenai via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 16 16:03:12 PDT 2022


smeenai added a comment.

process_vm_readv was introduced in Linux 3.2; is it okay to use it unconditionally for you? (aarch64 support was only added in Linux 3.7, so we were guaranteed to have the syscall available for it.)



================
Comment at: libunwind/src/UnwindCursor.hpp:2705
+  long bytesRead =
+      syscall(SYS_process_vm_readv, getpid(), &local_iov, 1, &remote_iov, 1, 0);
+  if (bytesRead == sizeof inst && (inst == 0x0a77 || inst == 0x0aad)) {
----------------
For aarch64, I went through `syscall` instead of the libc `process_vm_readv` wrapper because the latter wasn't guaranteed to be present even when the kernel supported the syscall (e.g. on Android 5). If you don't have that constraint, it'd be cleaner to just use the libc wrapper (assuming it's available on SystemZ).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129856/new/

https://reviews.llvm.org/D129856



More information about the libcxx-commits mailing list