Skip to content

affected/package: exec linux bad system call using Termux (Android) #60125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JanDeDobbeleer opened this issue May 11, 2023 · 7 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@JanDeDobbeleer
Copy link

JanDeDobbeleer commented May 11, 2023

What version of Go are you using (go version)?

$ go version

1.20.3

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

Android

What did you do?

run path, err := exec.LookPath(command)

Reported here and here.

What did you expect to see?

path, err := exec.LookPath(command) succeeds.

What did you see instead?

SIGSYS: bad system call
PC=0x12f80 m=0 sigcode=1

goroutine 1 [syscall]:
syscall.Syscall6(0x40000348d0?, 0x27?, 0x0?, 0x4f?, 0xffffffffffffff9c?, 0x4000034900?, 0x40000e4338?)
	/opt/hostedtoolcache/go/src/syscall/syscall_linux.go:91 +0x2c fp=0x400010f420 sp=0x400010f390 pc=0xc568c
syscall.faccessat2(0x76e1ecda08?, {0x40000348d0?, 0xc0?}, 0x1, 0x40000e4300?)
	/opt/hostedtoolcache/go/src/syscall/zsyscall_linux_arm64.go:33 +0x84 fp=0x400010f490 sp=0x400010f420 pc=0xc22c4
syscall.Faccessat(0x40000348d0?, {0x40000348d0, 0x27}, 0x1, 0x200)
	/opt/hostedtoolcache/go/src/syscall/syscall_linux.go:157 +0x3c fp=0x400010f570 sp=0x400010f490 pc=0xbfcac
internal/syscall/unix.Eaccess(...)
	/opt/hostedtoolcache/go/src/internal/syscall/unix/eaccess_linux.go:10
os/exec.findExecutable({0x40000348d0, 0x27})
	/opt/hostedtoolcache/go/src/os/exec/lp_unix.go:31 +0x58 fp=0x400010f5c0 sp=0x400010f570 pc=0x1b08b8
os/exec.LookPath({0x7de1de, 0x3})
	/opt/hostedtoolcache/go/src/os/exec/lp_unix.go:71 +0x1b8 fp=0x400010f660 sp=0x400010f5c0 pc=0x1b0b88
github.com/jandedobbeleer/oh-my-posh/src/platform.(*Shell).CommandPath(0x4000227b20, {0x7de1de, 0x3})
	/home/runner/work/oh-my-posh/oh-my-posh/src/platform/shell.go:578 +0xa0 fp=0x400010f720 sp=0x400010f660 pc=0x32c2a0
github.com/jandedobbeleer/oh-my-posh/src/platform.(*Shell).HasCommand(0x4000227b20, {0x7de1de, 0x3})
	/home/runner/work/oh-my-posh/oh-my-posh/src/platform/shell.go:590 +0x8c fp=0x400010f790 sp=0x400010f720 pc=0x32c4fc
github.com/jandedobbeleer/oh-my-posh/src/segments.(*scm).hasCommand(0x40003a91e0, {0x7de1de, 0x3})
	/home/runner/work/oh-my-posh/oh-my-posh/src/segments/scm.go:143 +0xf0 fp=0x400010f7f0 sp=0x400010f790 pc=0x4f3630
github.com/jandedobbeleer/oh-my-posh/src/segments.(*Git).shouldDisplay(0x40003a91e0)
	/home/runner/work/oh-my-posh/oh-my-posh/src/segments/git.go:248 +0x30 fp=0x400010f840 sp=0x400010f7f0 pc=0x4dd760
github.com/jandedobbeleer/oh-my-posh/src/segments.(*Git).Enabled(0x40003a91e0)
	/home/runner/work/oh-my-posh/oh-my-posh/src/segments/git.go:149 +0x90 fp=0x400010f890 sp=0x400010f840 pc=0x4dce60
github.com/jandedobbeleer/oh-my-posh/src/engine.(*Segment).SetEnabled(0x40001df6c0, {0x943a98, 0x4000227b20})
	/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:479 +0x12c fp=0x400010f920 sp=0x400010f890 pc=0x62591c
github.com/jandedobbeleer/oh-my-posh/src/engine.(*Block).Debug(0x40000bcc60)
	/home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:217 +0x118 fp=0x400010f9e0 sp=0x400010f920 pc=0x615a48
github.com/jandedobbeleer/oh-my-posh/src/engine.(*Engine).PrintDebug(0x400010fcb8, {0x7e0892?, 0x0?, 0x138eee0?}, {0x92e2d0?, 0x0?})
	/home/runner/work/oh-my-posh/oh-my-posh/src/engine/engine.go:275 +0x4c4 fp=0x400010fc00 sp=0x400010f9e0 pc=0x61a494
github.com/jandedobbeleer/oh-my-posh/src/cli.glob..func7(0x1368fe0?, {0x13c48b8?, 0x0?, 0x0?})
	/home/runner/work/oh-my-posh/oh-my-posh/src/cli/debug.go:47 +0x294 fp=0x400010fd30 sp=0x400010fc00 pc=0x68ebc4
github.com/spf13/cobra.(*Command).execute(0x1368fe0, {0x13c48b8, 0x0, 0x0})
	/opt/hostedtoolcache/go/pkg/mod/github.com/spf13/[email protected]/command.go:920 +0x5ac fp=0x400010fe70 sp=0x400010fd30 pc=0x1a0ddc
github.com/spf13/cobra.(*Command).ExecuteC(0x1369880)
	/opt/hostedtoolcache/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x340 fp=0x400010ff30 sp=0x400010fe70 pc=0x1a1530
github.com/spf13/cobra.(*Command).Execute(...)
	/opt/hostedtoolcache/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
github.com/jandedobbeleer/oh-my-posh/src/cli.Execute({0x92e2d0?, 0x40000021a0?})
	/home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:41 +0x58 fp=0x400010ff50 sp=0x400010ff30 pc=0x690878
main.main()
	/home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x2c fp=0x400010ff70 sp=0x400010ff50 pc=0x690f4c
runtime.main()
	/opt/hostedtoolcache/go/src/runtime/proc.go:250 +0x200 fp=0x400010ffd0 sp=0x400010ff70 pc=0x460e0
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x400010ffd0 sp=0x400010ffd0 pc=0x74ec4

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000068fa0 sp=0x4000068f80 pc=0x464f0
runtime.goparkunlock(...)
	/opt/hostedtoolcache/go/src/runtime/proc.go:387
runtime.forcegchelper()
	/opt/hostedtoolcache/go/src/runtime/proc.go:305 +0xb0 fp=0x4000068fd0 sp=0x4000068fa0 pc=0x46340
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x4000068fd0 sp=0x4000068fd0 pc=0x74ec4
created by runtime.init.6
	/opt/hostedtoolcache/go/src/runtime/proc.go:293 +0x24

goroutine 3 [GC sweep wait]:
runtime.gopark(0x1?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000069760 sp=0x4000069740 pc=0x464f0
runtime.goparkunlock(...)
	/opt/hostedtoolcache/go/src/runtime/proc.go:387
runtime.bgsweep(0x0?)
	/opt/hostedtoolcache/go/src/runtime/mgcsweep.go:319 +0x100 fp=0x40000697b0 sp=0x4000069760 pc=0x32d90
runtime.gcenable.func1()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:178 +0x28 fp=0x40000697d0 sp=0x40000697b0 pc=0x27de8
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x40000697d0 sp=0x40000697d0 pc=0x74ec4
created by runtime.gcenable
	/opt/hostedtoolcache/go/src/runtime/mgc.go:178 +0x6c

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x4000088000?, 0x92b3b0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000069f50 sp=0x4000069f30 pc=0x464f0
runtime.goparkunlock(...)
	/opt/hostedtoolcache/go/src/runtime/proc.go:387
runtime.(*scavengerState).park(0x138f060)
	/opt/hostedtoolcache/go/src/runtime/mgcscavenge.go:400 +0x5c fp=0x4000069f80 sp=0x4000069f50 pc=0x30cbc
runtime.bgscavenge(0x0?)
	/opt/hostedtoolcache/go/src/runtime/mgcscavenge.go:633 +0xa8 fp=0x4000069fb0 sp=0x4000069f80 pc=0x31258
runtime.gcenable.func2()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:179 +0x28 fp=0x4000069fd0 sp=0x4000069fb0 pc=0x27d88
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x4000069fd0 sp=0x4000069fd0 pc=0x74ec4
created by runtime.gcenable
	/opt/hostedtoolcache/go/src/runtime/mgc.go:179 +0xac

goroutine 5 [finalizer wait]:
runtime.gopark(0x0?, 0x852bf0?, 0x0?, 0x80?, 0x2000000020?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000068580 sp=0x4000068560 pc=0x464f0
runtime.runfinq()
	/opt/hostedtoolcache/go/src/runtime/mfinal.go:193 +0x100 fp=0x40000687d0 sp=0x4000068580 pc=0x26eb0
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x40000687d0 sp=0x40000687d0 pc=0x74ec4
created by runtime.createfing
	/opt/hostedtoolcache/go/src/runtime/mfinal.go:163 +0x80

goroutine 6 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x400006a740 sp=0x400006a720 pc=0x464f0
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1275 +0xe4 fp=0x400006a7d0 sp=0x400006a740 pc=0x29bc4
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x400006a7d0 sp=0x400006a7d0 pc=0x74ec4
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1199 +0x28

goroutine 17 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000064740 sp=0x4000064720 pc=0x464f0
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1275 +0xe4 fp=0x40000647d0 sp=0x4000064740 pc=0x29bc4
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x40000647d0 sp=0x40000647d0 pc=0x74ec4
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1199 +0x28

goroutine 33 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000586740 sp=0x4000586720 pc=0x464f0
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1275 +0xe4 fp=0x40005867d0 sp=0x4000586740 pc=0x29bc4
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x40005867d0 sp=0x40005867d0 pc=0x74ec4
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1199 +0x28

goroutine 34 [GC worker (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000586f40 sp=0x4000586f20 pc=0x464f0
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1275 +0xe4 fp=0x4000586fd0 sp=0x4000586f40 pc=0x29bc4
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x4000586fd0 sp=0x4000586fd0 pc=0x74ec4
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1199 +0x28

goroutine 18 [GC worker (idle)]:
runtime.gopark(0xecdacb135ccf?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000064f40 sp=0x4000064f20 pc=0x464f0
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1275 +0xe4 fp=0x4000064fd0 sp=0x4000064f40 pc=0x29bc4
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x4000064fd0 sp=0x4000064fd0 pc=0x74ec4
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1199 +0x28

goroutine 49 [GC worker (idle)]:
runtime.gopark(0xecdacb6aef05?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000582740 sp=0x4000582720 pc=0x464f0
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1275 +0xe4 fp=0x40005827d0 sp=0x4000582740 pc=0x29bc4
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x40005827d0 sp=0x40005827d0 pc=0x74ec4
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1199 +0x28

goroutine 35 [GC worker (idle)]:
runtime.gopark(0xecdacb6ada11?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/hostedtoolcache/go/src/runtime/proc.go:381 +0xe0 fp=0x4000587740 sp=0x4000587720 pc=0x464f0
runtime.gcBgMarkWorker()
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1275 +0xe4 fp=0x40005877d0 sp=0x4000587740 pc=0x29bc4
runtime.goexit()
	/opt/hostedtoolcache/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x40005877d0 sp=0x40005877d0 pc=0x74ec4
created by runtime.gcBgMarkStartWorkers
	/opt/hostedtoolcache/go/src/runtime/mgc.go:1199 +0x28

r0      0xffffffffffffff9c
r1      0x4000034930
r2      0x1
r3      0x200
r4      0x0
r5      0x0
r6      0x0
r7      0x1
r8      0x1b7
r9      0x2f7273752f73656c
r10     0x2e6d6f632f617461
r11     0x662f78756d726574
r12     0x7273752f73656c69
r13     0x7469672f6e69622f
r14     0x32
r15     0x2d3ac6aa6090
r16     0x400010e3a0
r17     0x400010f510
r18     0x0
r19     0xe10
r20     0x400010f5f0
r21     0x138fe80
r22     0x4000004000
r23     0x5a
r24     0x850180
r25     0xc8
r26     0x852f28
r27     0x0
r28     0x40000021a0
r29     0x400010f328
lr      0x12f3c
sp      0x400010f330
pc      0x12f80
fault   0x0
@seankhliao
Copy link
Member

go env output on the target platform please
and a self contained reproducer, including build instructions

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 11, 2023
@JanDeDobbeleer
Copy link
Author

JanDeDobbeleer commented May 11, 2023

@seankhliao I don't have an Android device, seems like the steps are perfectly reproducible on the device.

@seankhliao
Copy link
Member

Not trivially reproducible:

$ go version
go version go1.20.4 android/arm64
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/data/data/com.termux/files/home/.cache/go-build"
GOENV="/data/data/com.termux/files/home/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="android"
GOINSECURE=""
GOMODCACHE="/data/data/com.termux/files/home/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="android"
GOPATH="/data/data/com.termux/files/home/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/data/data/com.termux/files/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/data/data/com.termux/files/usr/lib/go/pkg/tool/android_arm64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
AR="ar"
CC="aarch64-linux-android-clang"
CXX="aarch64-linux-android-clang++"
CGO_ENABLED="1"
GOMOD="/data/data/com.termux/files/home/exec/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/data/data/com.termux/files/usr/tmp/go-build1895846673=/tmp/go-build -gno-record-gcc-switches"
$ cat main.go
package main

import (
        "fmt"
        "os/exec"
)

func main() {
        fmt.Println(exec.LookPath("vim"))
}
$ go run .
/data/data/com.termux/files/usr/bin/vim <nil>

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels May 11, 2023
@JanDeDobbeleer
Copy link
Author

@seankhliao ok, that's interesting. Could this imply that people are running a unix built executable on their Android device? Because that could explain a lot.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels May 11, 2023
@mateuszdrab
Copy link

mateuszdrab commented May 11, 2023

@seankhliao ok, that's interesting. Could this imply that people are running a unix built executable on their Android device? Because that could explain a lot.

That's pretty much it, termux is where I run the applications and it is just a specialized environment running on top of Android's kernel. Nevertheless, this used to work fine in previous releases of go therefore something changed as rolling back resolves it.

I'm suspecting that other go dependent packages will break sometime as well.

@seankhliao
Copy link
Member

on Android our supported environment is GOOS=android
running GOOS=linux isn't a properly supported configuration

@PatAbah
Copy link

PatAbah commented Feb 13, 2024

@mateuszdrab That's pretty much it, termux is where I run the applications and it is just a specialized environment running on top of Android's kernel. Nevertheless, this used to work fine in previous releases of go therefore something changed as rolling back resolves it.

rolling back resolves it.

Rolling back to which version please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants