Skip to content

Conversation

al45tair
Copy link
Contributor

We used to try to use process_vm_readv() if CAP_SYS_PTRACE is enabled. This avoided using signal handlers to catch crashes when we try to read through an invalid pointer, but it complicates the code and it turns out not to work on some Linux kernels where the process_vm_readv() syscall is unavailable.

rdar://159930644

We used to try to use `process_vm_readv()` if `CAP_SYS_PTRACE` is
enabled.  This avoided using signal handlers to catch crashes when
we try to read through an invalid pointer, but it complicates the
code and it turns out not to work on some Linux kernels where
the `process_vm_readv()` syscall is unavailable.

rdar://159930644
@al45tair al45tair requested a review from a team as a code owner September 26, 2025 07:58
@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair
Copy link
Contributor Author

Explanation: We had code in the runtime that tried to use process_vm_readv if it has the CAP_SYS_PTRACE capability, rather than relying on a signal handler to catch crashes when reading invalid memory. Unfortunately, some kernels are built with process_vm_readv disabled, which results in this strategy failing.
Risk: Low. Only affects crashes.
Original PR: #84122
Reviewed by: @mikeash @owenv @FranzBusch
Resolves: rdar://161391330, rdar://159930644
Tests: This removes the process_vm_readv code path, so the other code path will be the only one that can possibly run in the backtracing tests.

@shahmishal shahmishal merged commit 5117ae5 into swiftlang:release/6.2 Sep 26, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants