Skip to content

K2GO-411 fix(proot): translate aarch32 futex_time64 to host futex for 32-bit Go on pre-5.1 kernels - #577

Merged
luisguzman-adfa merged 1 commit into
mainfrom
feat/K2GO-411-proot-futex-time64
Sep 23, 2026
Merged

luisguzman-adfa merged 1 commit into
mainfrom
feat/K2GO-411-proot-futex-time64

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

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 issues futex_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_configure block (same mechanism as the existing fchmodat2 patch), to remap aarch32 futex_time64 to the host futex. Four idempotent, guarded edits, mirroring the fchmodat2 block:

  • sysnums.list: declare 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; 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). 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) and forgejo --version runs with no futexwakeup ... returned -38. bash -n on the build script passes. Not a seccomp issue; PROOT_NO_SECCOMP=1 does not help. Merging rebuilds the proot binaries. Full analysis, repro, and the arm 403-423 family in K2GO-411.

@luisguzman-adfa
luisguzman-adfa merged commit ac69e21 into main Sep 23, 2026
2 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the feat/K2GO-411-proot-futex-time64 branch September 23, 2026 16:20
… 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.
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