Repository navigation
Fix proot TLS underalignment and build proot 3c6aa6f with the link2symlink/fake_id0 fixes - #28
Merged
Merged
Conversation
…1.107.101 - Update proot to v5.1.107.101 (commit 968ae1be) with link2symlink fix - Patch PT_TLS p_align 8->64 for arm64-v8a to satisfy bionic's TLS alignment requirement - Build with NDK r27c for arm64-v8a - This fixes the 'TLS segment underaligned' abort on Android 14+ devices
…for arm64 - Update proot to v5.1.107.101 (commit 968ae1be) with link2symlink fix - Fix TLS alignment for arm64-v8a: patch PT_TLS p_align 8->64 - armv7 binary built with linker script for TLS alignment (known issue: TLS alignment not fully fixed) - All 4 architectures built with proot v5.1.107.101 - Proot binaries updated in jniLibs for all 4 architectures
…ries bionic's ARM32 static-TLS check (StaticTlsLayout in bionic_elf_tls.cpp) gates on p_align AND the vaddr skew together: a plain NDK link emits p_align 8 with a 16-aligned vaddr, which aborts on-device with "executable's TLS segment is underaligned ... needs to be at least 32 for ARM Bionic". Patching the program header alone cannot fix the vaddr half, because p_vaddr also feeds init_ptr, the address bionic copies the TLS template from. Re-link armv7 and i686 with a linker script that START-aligns .tdata at 32 (PT_TLS p_align 32, skew 0); the previous scripts only end-aligned .tdata and their ld.bfd re-link was a no-op (the NDK ships no ld.bfd). 64-bit keeps the p_align 64 program-header patch, which now actually writes the file back. build-proot.sh: the -T script is baked into the main link, the 32-bit branch verifies instead of the dead re-link, the ABI case is fixed (i686's ABI is "x86"), and the loader page-size injection is idempotent. All four ABIs rebuilt from d4d2a19: arm64 p_align 64 / armv7 32 / i686 32 / x86_64 64, every LOAD 16 KB aligned, entry at bionic's static _start.
… binaries The rm -rf .git/objects/pack EPERM in a distro session is a link2symlink issue, fixed in the commit series between d4d2a19 and 3c6aa6f (968ae1b 'link symbolic links as symbolic links', the fake_id0 statx/chmod record series, 32-bit getdents parsing). The previous binaries were built from d4d2a19, which predates all of it, so the TLS fix alone could not heal it. Bump PROOT_VERSION to 3c6aa6f and rebuild all four ABIs: arm64 p_align 64 (vaddr 64-aligned), armv7 p_align 32 (skew 0), i686 p_align 32 (skew 0), x86_64 p_align 64 (no bionic gate there, so the vaddr-64 hard guard now applies to arm64 only). 16 KB aligned throughout.
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
1 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two proot fixes, both needed before distro sessions work on 32-bit devices
and before
rm -rfworks in.gittrees:check (
StaticTlsLayout::reserve_exe_segment_and_tcbinbionic_elf_tls.cpp) aborts executables whose PT_TLS is underaligned;it gates on
p_alignand the vaddr skew together. A plain NDKlink emits p_align 8 with a 16-aligned vaddr, so armv7 sessions died
at proot startup ("executable's TLS segment is underaligned ... needs
to be at least 32 for ARM Bionic").
rm -rf .git/objects/pack→ EPERM — a link2symlink/fake_id0issue fixed only in the commit series between
d4d2a19and3c6aa6f(notably968ae1b "link symbolic links as symbolic links", the fake_id0 statx/chmod-record series, 32-bit getdentsparsing). The previous binaries were built from
d4d2a19, whichpredates all of it.
All four
libproot.soare now built from proot3c6aa6fwith theTLS alignment applied.
Changes
native/proot-tls-align-armv7a.ld,native/proot-tls-align-i686.ld:full lld-compatible layout scripts;
.tdata/.tbssstart-aligned at32 (skew 0), 16 KB data-segment alignment
native/build-proot.sh:PROOT_VERSIONbumped to3c6aa6f; the-Wl,-Tscript is baked into the main link; 32-bit branch verifiesp_align/vaddr instead of a dead
ld.bfdre-link (the NDK ships nold.bfd); ABI case fixed (i686's ABI is
x86); the 64-bit p_alignpatch writes the file back and its vaddr-64 hard guard now applies to
arm64 only (i386/x86_64 have no bionic TLS gate; x86_64 links with a
32-aligned vaddr and is stamped p_align 64 without aborting); loader
page-size injection is idempotent
app/src/main/jniLibs/*/— all four ABIs rebuilt and verified:arm64-v8a: PT_TLS p_align 64, vaddr 64-alignedarmeabi-v7a: PT_TLS p_align 32, vaddr skew 0x86: PT_TLS p_align 32, vaddr skew 0x86_64: PT_TLS p_align 64 (vaddr 32-aligned; no gate on i386/x86_64)All ET_EXEC, every LOAD 16 KB-page aligned, entry at bionic's static
_start,.tdatatemplate bytes preservedHow it was tested
.tdatacontents byte-identical before/after the re-link; clean
./gradlew clean assembleDebugwith zero compiler warnings; APKlibproot.somd5-identical to jniLibs for all four ABIsrm -rfon the affected device(the TLS crash itself is already confirmed gone on the rebuilt
arm64 binary)
Checklist
./gradlew assembleDebugclean build passes;lintDebugnot runin this pass
## [Unreleased]if user-visible(deliberately untouched until the on-device verification lands,
per project convention)