Open srenatus opened 2 years ago
Running the prograrm natively with go version go1.16.6 linux/arm64
it works alright for me, and in docker on the same machine it unfortunately doesn't get past this line. My guess though is that this is likely related to one of the emulation layers involved?
@alexcrichton What is your kernel version? For example, Ubuntu 18.04 (which, unfortunately in this case, is still supported) by default ships with a kernel that does not support the variant of the membarrier()
system call you are pointing at (i.e. the kernel is older than 4.16).
My uname -a
reports as:
Linux arm2-ci.infra.bytecodealliance.org 4.19.0-9-arm64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) aarch64 GNU/Linux
So I think it may be supported? I'll note that the membarrier
call only fails inside of docker for me, natively it works just fine (not sure what's happening there, I'm just sort of naively assuming it's some docker thing)
You are probably right - Docker stopped blocking membarrier()
by default less than 2 years ago. You can try this suggestion from the documentation to unblock it.
Ah perfect! Pasing --security-opt seccomp=unconfined
to docker run
I'm able to successfully run this program on Linux arm64 hardware, even in docker. That may mean @srenatus that the issue here is Docker's arm64 emulation on x86_64? Or I'm not actually sure, what is the host system you're running on when you're passing --platform linux/arm64
to docker and seeing the crash?
I'm not actually sure, what is the host system you're running on when you're passing --platform linux/arm64 to docker and seeing the crash?
Host is macos 12.1 (Darwin Kernel Version 21.2.0 Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 x86_64
), running docker desktop 4.1.1... docker tells me this much about its kernel:
$ docker run -it --platform linux/amd64 alpine uname -a
Linux fe90a75cad3e 5.10.47-linuxkit #1 SMP Sat Jul 3 21:51:47 UTC 2021 x86_64 Linux
$ docker run -it --platform linux/arm64 alpine uname -a
Linux dbab877dfae4 5.10.47-linuxkit #1 SMP Sat Jul 3 21:51:47 UTC 2021 aarch64 Linux
Ah ok, looks like you're emulating linux-arm64 on macos-x86_64. AFAIK that's a pretty serious emulation layer and given that the issue only happens there I'd probably chalk it up to the emulation layer for now.
FWIW I've noticed this originally emulating arm64 on Linux/amd64, in a GitHub action run. But I've got little control over that environment, so I've taken the laptop for reproducing the error. Probably still got something to do with the emulation involved... 🤷
@alexcrichton thanks for taking the time to look into this with me ❤️
With this main.go (files here):
The following command instantly fails for me:
It works fine and loops for a while if run using
--platform linux/amd64
or if not using docker at all, on macos/amd64 host. Since qemu and binfmt_misc is involved when running a different platform, I don't know if the problem happens on a actual linux/arm64 hardware, or if this is somehow emulation-related.