golang/go

runtime: `linux/s390x` `ThreadSanitizer failed to allocate 0x7e0000 (8257536) bytes at address 900000180000 (errno: 12)` in QEMU

Open

#67,881 opened on Jun 7, 2024

View on GitHub
 (9 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsInvestigationarch-s390xcompiler/runtimehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Go version

go version go1.22.3 linux/amd64

Output of go env in your module/workspace:

GOARCH=s390x

What did you do?

Cross-compiled a race build test binary from linux/amd64 to linux/s390x:

      - name: 'BuildTestRace with ${{ matrix.go }} for ${{ matrix.arch }}'
        if: ${{ matrix.arch == 'aarch64' && !matrix.arm64_race_unsupported || matrix.arch == 's390x' && !matrix.s390x_race_unsupported }}
        env:
          CGO_ENABLED: 1
        shell: bash
        run: |
          set -euxo pipefail

          # Non-host *.syso files are missing from the Go toolchains provided
          # by setup-go. See https://github.com/actions/setup-go/issues/181.
          curl --location --output "$(go env GOROOT)"/src/runtime/race/race_linux_"$GOARCH".syso \
            https://github.com/golang/go/raw/release-branch.go${{ matrix.go }}/src/runtime/race/race_linux_"$GOARCH".syso

          sudo apt update
          sudo apt install -y gcc-${{ matrix.arch }}-linux-gnu

          CC=${{ matrix.arch }}-linux-gnu-gcc CC_FOR_TARGET=gcc-${{ matrix.arch }}-linux-gnu go test -c -race -o goid.race.test ./...

where GOARCH=s390x and ${{ matrix.arch }} == s390x, and then attempted to run that binary using docker-on-qemu:

      - name: 'Test and Bench with ${{ matrix.go }} on ${{ matrix.arch }}'
        if: ${{ matrix.arch != '386' && matrix.arch != 'x64' && !matrix.qemu_emulation_broken }}
        uses: uraimo/run-on-arch-action@v2
        with:
          arch: ${{ matrix.arch }}
          distro: bookworm
          dockerRunArgs: --mount type=bind,source="$(pwd)",target=/checkout,readonly
          shell: /bin/bash
          run: |
            set -euxo pipefail

            find /checkout -name '*.test' -type f -executable -print0 | \
              xargs -t -0 -I '{}' sh -c '{} -test.v && {} -test.bench=. -test.benchmem -test.v'

What did you see happen?

+ find /checkout -name '*.test' -type f -executable -print0
  + xargs -t -0 -I '{}' sh -c '{} -test.v && {} -test.bench=. -test.benchmem -test.v'
  sh -c '/checkout/goid.race.test -test.v && /checkout/goid.race.test -test.bench=. -test.benchmem -test.v'
  ==17==ERROR: ThreadSanitizer failed to allocate 0x7f0000 (8323072) bytes at address 9000001a0000 (errno: 12)
  sh -c '/checkout/goid.test -test.v && /checkout/goid.test -test.bench=. -test.benchmem -test.v'
  === RUN   TestGet
  --- PASS: TestGet (0.01s)
  PASS
  === RUN   TestGet
  --- PASS: TestGet (0.01s)
  goos: linux
  goarch: s390x
  pkg: github.com/petermattis/goid
  cpu: AMD EPYC 7763 64-Core Processor @ 3242.4[67](https://github.com/petermattis/goid/actions/runs/9417707064/job/25943521220?pr=44#step:16:68)MHz
  BenchmarkGet
  BenchmarkGet-4   	130759052	         9.021 ns/op	       0 B/op	       0 allocs/op
  PASS
  Error: The process '/home/runner/work/_actions/uraimo/run-on-arch-action/v2/src/run-on-arch.sh' failed with exit code 123

What did you expect to see?

I expected the test to pass.

Contributor guide