Skip to content

fix(release): build Android libraries with 16 KB-aligned LOAD segments - #56

Merged
acking-you merged 1 commit into
devfrom
fix/android-16k-alignment
Oct 27, 2026
Merged

acking-you merged 1 commit into
devfrom
fix/android-16k-alignment

Conversation

@acking-you

Copy link
Copy Markdown
Owner

The released Android libraries are not 16 KB page-aligned. This PR builds them with an NDK that aligns to 16 KB and makes the release job refuse to publish one that isn't.

Evidence

Release 0.6.13 (libhttp_proxy-0.6.13-{aarch64,x86_64}-linux-android.tar.gz, SHA-256 matching GitHub's digests): every LOAD segment of libhttp_proxy.so is aligned to 0x1000 (4 KB). docs/android-vpn.md requires 0x4000 or more. Android 15+ devices running 16 KB pages cannot load such a library, and Google Play rejects it for those targets.

Cause: build-deploy.yaml links with NDK r26d, whose clang driver passes a 4 KB max page size. rustc adds no page-size flag for Android. Local builds were fine, because scripts/android/build-native.ps1 defaults to NDK 28.2.

Change

  • build-deploy.yaml: NDK r26d → r28c (28.2.13676358). That is the flutter.ndkVersion of the pinned Flutter SDK (3.47.7 and 3.47.8) and build-native.ps1's default, so app, local and release builds now share one NDK. r28 aligns to 16 KB by default and still supports API 24.
  • verify-native-assets.py: parses each aarch64-linux-android / x86_64-linux-android libhttp_proxy.so's ELF program headers and fails the release if any LOAD segment is below 16 KB. armv7 is 32-bit and exempt. One new test covers the rejection; the fixtures for those two targets are now minimal 16 KB-aligned ELF files.
  • docs/android-vpn.md: names the shared NDK and the new check.

Verified

  • With NDK r28c (verified against the size and SHA-1 in Google's SDK manifest), on this branch's toolchain: cargo build -p proxy-ffi --locked --release --target {aarch64,x86_64}-linux-android. Every LOAD segment is 0x4000 (llvm-readelf -lW).
  • The new check rejects both published 0.6.13 libraries and accepts both r28c builds.
  • python3 -m unittest discover -s scripts/release -p 'test_*.py': 5 tests OK. make fmt clean. make clippy shows only the existing infallible_destructuring_match warning in proxy-client.

Not verified

  • The release workflow itself only runs on a tag, so nttld/setup-ndk resolving r28c on ubuntu-latest is untested. The action documents rNNx versions, the same form as the old r26d.
  • No run on a 16 KB-page device or emulator.
  • armv7 alignment is unchanged and not checked.

Independent of #55 (the dependency upgrade); either can land first.

🤖 Generated with Claude Code

Release 0.6.13's aarch64 and x86_64 libhttp_proxy.so have every LOAD segment
aligned to 4 KB: the release workflow links them with NDK r26d, whose clang
driver passes a 4 KB max page size. Android 15+ devices running 16 KB pages
cannot load such a library, and Google Play rejects it for those targets.
Local builds were already fine because build-native.ps1 uses NDK 28.2.

- build-deploy.yaml: NDK r26d -> r28c (28.2.13676358), the flutter.ndkVersion
  of the pinned Flutter SDK and build-native.ps1's default. r28 aligns to
  16 KB by default and still supports API 24.
- verify-native-assets.py: read each 64-bit Android library's program headers
  and refuse to publish one with a LOAD segment below 16 KB, so a toolchain
  change cannot silently regress this. armv7 is exempt (32-bit).
- docs/android-vpn.md: name the shared NDK and the new release check.

Built proxy-ffi --release for both targets with NDK r28c: all LOAD segments
0x4000. The new check rejects the published 0.6.13 libraries and accepts
these.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T09:41:48.622259Z 2aae003 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@acking-you
acking-you merged commit 988a1df into dev Oct 27, 2026
3 checks passed
@acking-you
acking-you deleted the fix/android-16k-alignment branch October 27, 2026 13:13
acking-you added a commit that referenced this pull request Oct 28, 2026
Native 0.6.14 carries the toolchain and dependency upgrade (#55, with the
review fixes in tun2proxy, ipstack, kanal-plus 0.2.2 and mimalloc), Android
libraries with 16 KB-aligned LOAD segments and a release gate for them (#56),
and the QUIC/TCP switching tracking from #54.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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