Repository navigation
K2GO-411 fix(proot): translate aarch32 futex_time64 to host futex for 32-bit Go on pre-5.1 kernels - #577
Merged
Conversation
… 32-bit Go on pre-5.1 kernels 32-bit Go binaries (e.g. Forgejo arm-6) crash under the K2Go proot on devices whose real kernel is older than Linux 5.1: Go's linux/arm runtime issues futex_time64 (arm #422), which the kernel lacks and proot did not translate, so it returned ENOSYS and Go aborted with "futexwakeup returned -38". Patch the bundled termux-packages proot at build time, in the proot termux_step_pre_configure block (same mechanism as the fchmodat2 patch), to remap the aarch32 futex_time64 to the host futex. Four idempotent, guarded edits: - sysnums.list: declare the abstract PR_futex_time64. - enter.c: set_sysnum(tracee, PR_futex) at sysenter. - sysnums-*.h: map raw 422 in the 32-bit ABI tables; the "[ 240 ] = PR_futex" anchor auto-scopes to arm/i386, so arm64/x86_64 skip. - seccomp.c: trace it so the rewrite runs in the default seccomp-accelerated mode. __kernel_timespec is 64-bit and byte-compatible with the host timespec, so this is a syscall-number remap, not an argument rewrite. Builds still cover both arm64-v8a and armeabi-v7a; the patch is inert in the 64-bit table. Device-verified: the futex_time64(422) C probe returns 0 (was ENOSYS) and forgejo --version runs with no crash. Not a seccomp issue; PROOT_NO_SECCOMP=1 does not help.
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.
What this PR changes
Fixes K2GO-411: 32-bit Go binaries (e.g. Forgejo
arm-6) crash under the K2Go proot on devices whose real kernel is older than Linux 5.1, because Go issuesfutex_time64(arm #422), which the kernel lacks and proot did not translate -> ENOSYS ->futexwakeup ... returned -38.Patches the bundled termux-packages proot at build time, in the proot
termux_step_pre_configureblock (same mechanism as the existingfchmodat2patch), to remap aarch32futex_time64to the hostfutex. Four idempotent, guarded edits, mirroring thefchmodat2block:sysnums.list: declarePR_futex_time64.enter.c:set_sysnum(tracee, PR_futex)at sysenter.sysnums-*.h: map raw422in the 32-bit ABI tables (the[ 240 ] = PR_futexanchor auto-scopes to arm/i386; arm64/x86_64 skip).seccomp.c: trace it so the rewrite runs in the default seccomp-accelerated mode.__kernel_timespecis 64-bit and byte-compatible with the hosttimespec, so this is a syscall-number remap, not an argument rewrite. Builds still cover BOTHarm64-v8aandarmeabi-v7a(the patch is inert in the 64-bit table). Four build-time guards fail the build loudly if any anchor does not resolve.Verification
Device-verified on a pre-5.1-kernel device: the
futex_time64(422)C probe returns 0 (was ENOSYS) andforgejo --versionruns with nofutexwakeup ... returned -38.bash -non the build script passes. Not a seccomp issue;PROOT_NO_SECCOMP=1does not help. Merging rebuilds the proot binaries. Full analysis, repro, and the arm 403-423 family in K2GO-411.