golang 1.23 build hangs when running under qemu-user on x86_64 host
<!--
This is the upstream QEMU issue tracker.
If you are able to, it will greatly facilitate bug triage if you attempt
to reproduce the problem with the latest qemu.git master built from
source. See https://www.qemu.org/download/#source for instructions on
how to do this.
QEMU generally supports the last two releases advertised on
https://www.qemu.org/. Problems with distro-packaged versions of QEMU
older than this should be reported to the distribution instead.
See https://www.qemu.org/contribute/report-a-bug/ for additional
guidance.
If this is a security issue, please consult
https://www.qemu.org/contribute/security-process/
-->
## Host environment
- Operating system: Fedora 40
- OS/kernel version: Linux cheese-x1tablet 6.11.11-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 18:38:25 UTC 2024 x86_64 GNU/Linux
- Architecture: x86_64
- QEMU flavor: qemu-user
- QEMU version: 9.2.0
- QEMU command line:
<!--
Give the smallest, complete command line that exhibits the problem.
If you are using libvirt, virsh, or vmm, you can likely find the QEMU
command line arguments in /var/log/libvirt/qemu/$GUEST.log.
-->
```
/usr/bin/qemu-loongarch64-static /buildstream-build/pkg/tool/linux_loong64/go_bootstrap install -pgo=off cmd/asm cmd/cgo cmd/compile cmd/link cmd/preprofile
```
## Emulated/Virtualized environment
- Operating system: N/A
- OS/kernel version: N/A
- Architecture: any
## Description of problem
<!-- Describe the problem, including any error/crash messages seen. -->
Forwarded from https://github.com/golang/go/issues/70329.
### What did you do?
When I build Go 1.23 with the same version of Go under qemu-user, the build hangs all the way. The issue can be reproduced with a Dockerfile:
```Dockerfile
from quay.io/fedora/fedora:41
RUN dnf install -y @development-tools
RUN curl -O https://go.dev/dl/go1.23.3.src.tar.gz && curl -O https://go.dev/dl/go1.23.3.linux-arm64.tar.gz
RUN tar fx go1.23.3.linux-arm64.tar.gz && mkdir src && tar fx go1.23.3.src.tar.gz -C src
RUN cd src/go/src/; env PATH=$PATH:/go/bin bash make.bash
```
Tested on Fedora 40 with `6.9.8-200.fc40.x86_64` and Fedora 41 with `6.11.6-300.fc41.x86_64`.
Tested with qemu-user 9.1.1 of riscv64/loongarch64/aarch64.
### What did you see happen?
The go processes of the build hangs forever:
```
│ ├─crun-buildah-buildah663882417.scope
│ │ └─container
│ │ ├─912459 /usr/bin/qemu-aarch64-static /usr/bin/bash make.bash
│ │ ├─914348 /usr/bin/qemu-aarch64-static ./cmd/dist/dist bootstrap -a
│ │ ├─914395 /usr/bin/qemu-aarch64-static /go/bin/go install "-tags=math_big_pure_go compiler_bootstrap purego" bootstrap/cmd/...
│ │ └─914743 /usr/bin/qemu-aarch64-static /go/bin/go install "-tags=math_big_pure_go compiler_bootstrap purego" bootstrap/cmd/...
```
The issue does not exist with Go 1.22. I did a bisect and found the offending commit https://github.com/golang/go/commit/d068c2cb620c1daeedc8b9cce488af45a6c2c889 .
So it seems related to the emulation of eventfd of qemu-user.
### What did you expect to see?
Build of Go 1.23 runs through under qemu-user.
## Steps to reproduce
1. Setup qemu-user binfmt for a foreign ISA, for example, installs qemu-user-static-aarch64 on Fedora.
2. Build the Dockerfile for specified arch: `podman build --arch aarch64 .`
## Additional information
<!--
Attach logs, stack traces, screenshots, etc. Compress the files if necessary.
If using libvirt, libvirt logs and XML domain information may be relevant.
-->
<!--
The line below ensures that proper tags are added to the issue.
Please do not remove it.
-->
issue