Skip to content

opencode1 1.18.34 crashes on Android 12: seccomp kills close_range with SIGSYS #36

Closed

Description

@DARKBOYJYOTI

Summary

opencode1 1.18.34 from release Push261005 cannot start in Termux on this Android 12 device. Even opencode1 --version is terminated with SIGSYS because the process invokes the close_range syscall and Android's seccomp policy blocks it.

This appears related to the older native-build startup crash reported in #17, but this report includes a trace identifying the exact blocked syscall on a newer release and a different Android/kernel environment.

Environment

  • Termux app: 0.119.0-beta.3 (GitHub build)
  • Android: 12, API level 31
  • ABI: arm64-v8a (AArch64)
  • Kernel: 4.14.190-perf-ga0a12da82658
  • Package: opencode1 1.18.34
  • Release: Push261005

Steps to reproduce

  1. Install opencode1 1.18.34 in Termux.

  2. Run:

    opencode1 --version

Expected behavior

The command prints the version and exits successfully.

Actual behavior

The process exits with status 159 (SIGSYS) and the shell reports:

Bad system call

A trace of the process shows the seccomp-generated signal and identifies the blocked syscall:

rt_tgsigqueueinfo(..., SIGSYS, {
  si_signo=SIGSYS,
  si_code=SYS_SECCOMP,
  si_syscall=__NR_close_range,
  si_arch=AUDIT_ARCH_AARCH64
}) = 0
--- SIGSYS {si_signo=SIGSYS, si_code=SYS_SECCOMP, ...} ---
+++ killed by SIGSYS +++

Diagnosis and suggested fix

The binary (or a bundled runtime/library) invokes close_range, which is blocked by the Android app seccomp policy on this device. Please identify which component issues the syscall and provide a compatible fallback. Possible approaches include avoiding close_range on Android or falling back to closing file descriptors individually when the syscall is unavailable or denied, where the runtime permits that behavior.

If the syscall is emitted by the bundled runtime/toolchain and cannot be handled by application-level fallback, please consider an Android-compatible build/runtime or a targeted compatibility patch. Testing on Android 12 with a 4.14 kernel would verify the fix.

Related report

This may be related to the native build startup failure described in #17. The current report narrows the failure down to close_range on opencode1 1.18.34.

Activity

  1. Hope2333 commented on Oct 17, 2026

    @Hope2333
    Owner

    Fixed in Push261016 — thank you for the precise strace, it made this a quick root-cause.

    Root cause: the libopencode-crhandler.so seccomp shim (which interposes close_range() with -ENOSYS, exactly the fallback you suggested) was shipped inside the packages but was never actually linked in — the binary's DT_NEEDED list didn't reference it, so the dynamic linker never loaded it and the raw close_range syscall went straight to the seccomp filter. Three wiring bugs caused this (the v1 family-native chain never invoked the hardening step; the v2 direct-build path bypassed it; the compression tool compressed un-hardened binaries). Our local smoke tests all passed because this device's seccomp policy doesn't block close_range — exactly the environment-dependent blind spot you flagged.

    Fix: all three paths now run the zero-displacement DT_NEEDED patch (shim first in the lookup chain) before packaging/compression, and the compression tool refuses un-hardened binaries. Affected packages were repacked and re-uploaded:

    • v1 opencode1 native 1.18.30–1.18.34 (Push261005), 1.18.35 / 1.19.0 (Push261013)
    • v2 opencode native 2.0.23–2.0.27 (Push261013)
    • all corresponding *-compressed packages

    Verify after install: readelf -dW /data/data/com.termux/files/usr/lib/opencode1/runtime/opencode | grep crhandler should list libopencode-crhandler.so (for compressed packages, uncompress first with upx -d). The same batch also ships v2 2.0.28–2.0.31 and v1 1.19.1–1.19.3 if you want to move up.

    We don't have an Android 12 device in our test matrix, so if you can re-test opencode1 --version on the Push261016 build of your version, that would close the loop — and if anything still trips, the full strace again would be gold.

  2. DARKBOYJYOTI commented on Oct 18, 2026

    @DARKBOYJYOTI
    Author

    Thanks for the quick turnaround and the detailed root-cause writeup — much appreciated. I re-tested the Push261016 build: opencode1 --version and the TUI startup both work fine on my Android 12 device now. Confirming the close_range/SIGSYS issue is resolved on my end. Thanks again for shipping the fix.

  3. Hope2333 commented on Oct 23, 2026

    @Hope2333
    Owner

    Closing — you confirmed the Push261016 build works on your Android 12 device, which closes the loop. Thanks for the precise strace (it made the root cause a same-day fix) and for coming back to re-test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions