android / android/ndk

[FR] enable PAC/BTI by default?

Open
#1,914 8 comments 0 reactions 1 assignee Claimed by @Sharjeel-Khan View on GitHub
enhancement
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

### Description

NDK r25 shipped support for PAC/BTI, but it was (and remains in r26) off by default. These features mitigate ROP/JOP attacks, and our docs (https://developer.android.com/ndk/guides/memory-debug) recommend always enabling them.

The downsides to enabling this by default are a marginal (1%) code size increase, and a risk that developers may do their testing on devices that do not support PAC/BTI. The instructions are NOPs on devices that do not support them so that won't cause problems if the code is correct, but it does mean that developers won't know if their PAC/BTI enabled code will run correctly on a capable device.

The code size increase is marginal, and we prefer to be safe by default. Developers can opt out of PAC/BTI is that marginal increase in code size is not worth the increased security for their app.

The odds that developers have PAC/BTI capable devices for testing are going up every year, and it sounds like it might be a reasonable option in 2024 (when r27 will ship). It will of course be mentioned in the changelog so developers without such devices will be aware of the risk.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.