Skip to content

fix(native): Strip PAC bits from return addresses on Linux and Android arm64 - #2360

Open
jpnurmi wants to merge 1 commit into
v1from
jpnurmi/fix/native-strip-pac
Open

jpnurmi wants to merge 1 commit into
v1from
jpnurmi/fix/native-strip-pac

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Required for:

On arm64 with pointer authentication, frame records hold signed return addresses. The handler's capture recorded them as junk, and the daemon's own walk would too, because SENTRY__STRIP_PAC only stripped on macOS.

Replace it with a shared sentry__strip_pac(), which keeps the macOS mask and uses xpaclri on Linux and Android, a NOP on CPUs without PAC. A fixed mask does not fit there because the PAC bits start at the virtual address size, such as bit 39 on Android.

Like strip_pac() in libunwindstack-ndk from getsentry/libunwindstack-ndk#12 and StripPACBits() in crashpad from getsentry/crashpad#118, it binds the address to x30 with a register variable for xpaclri.

On arm64 with pointer authentication, frame records hold signed
return addresses. The handler's capture recorded them as junk, and
the daemon's own walk would too, because `SENTRY__STRIP_PAC` only
stripped on macOS.

Replace it with a shared `sentry__strip_pac()`, which keeps the macOS
mask and uses `xpaclri` on Linux and Android, a NOP on CPUs without
PAC. A fixed mask does not fit there because the PAC bits start at
the virtual address size, such as bit 39 on Android.

Like `strip_pac()` in libunwindstack-ndk from
getsentry/libunwindstack-ndk#12 and `StripPACBits()` in crashpad from
getsentry/crashpad#118, it binds the address to x30 with a register
variable for `xpaclri`.

Ref: getsentry/sentry-react-native#7152
@jpnurmi
jpnurmi force-pushed the jpnurmi/fix/native-strip-pac branch from 4c75783 to 2e21886 Compare December 1, 2026 12:24

This branch has not been deployed

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

1 participant