#1112166 golang-1.24: FTBFS on riscv64: FATAL: ThreadSanitizer: memory layout is incompatible, even though ASLR is disabled #1112166
- Package:
- golang-1.24
- Source:
- golang-1.24
- Submitter:
- Bo YU
- Date:
- 2025-09-20 04:37:01 UTC
- Severity:
- normal
- Tags:
Dear Maintainer,
Now golang-1.24 has one FTBFS on riscv64 due to:
```
--- FAIL: TestShared (0.00s)
cshared_test.go:61: skipping msan_shared test on linux/riscv64; -msan option is not supported.
--- FAIL: TestShared/tsan_shared (121.78s)
cshared_test.go:112: /usr/bin/setarch riscv64 -R /tmp/TestSharedtsan_shared3507443847/001/tsan_shared exited with exit status 66
FATAL: ThreadSanitizer: memory layout is incompatible, even though ASLR is disabled.
Please file a bug.
==63940==Process memory map follows:
0x002aaaaaa000-0x002aaaaab000 /tmp/TestSharedtsan_shared3507443847/001/tsan_shared
0x002aaaaab000-0x002aaaaac000 /tmp/TestSharedtsan_shared3507443847/001/tsan_shared
0x002aaaaac000-0x002aaaaad000 /tmp/TestSharedtsan_shared3507443847/001/tsan_shared
0x003fe6c51000-0x003fe6c66000
0x003fe6c66000-0x003fe6c82000 /usr/lib/riscv64-linux-gnu/libgcc_s.so.1
0x003fe6c82000-0x003fe6c83000 /usr/lib/riscv64-linux-gnu/libgcc_s.so.1
0x003fe6c83000-0x003fe6c84000 /usr/lib/riscv64-linux-gnu/libgcc_s.so.1
0x003fe6c84000-0x003fe6d07000 /usr/lib/riscv64-linux-gnu/libm.so.6
0x003fe6d07000-0x003fe6d08000 /usr/lib/riscv64-linux-gnu/libm.so.6
0x003fe6d08000-0x003fe6d09000 /usr/lib/riscv64-linux-gnu/libm.so.6
0x003fe6d09000-0x003fe6e5e000 /usr/lib/riscv64-linux-gnu/libc.so.6
0x003fe6e5e000-0x003fe6e61000 /usr/lib/riscv64-linux-gnu/libc.so.6
0x003fe6e61000-0x003fe6e63000 /usr/lib/riscv64-linux-gnu/libc.so.6
0x003fe6e63000-0x003fe6e6f000
0x003fe6e6f000-0x003fe6f09000 /tmp/TestSharedtsan_shared3507443847/001/libtsan_shared.so
0x003fe6f09000-0x003fe6f6f000 /tmp/TestSharedtsan_shared3507443847/001/libtsan_shared.so
0x003fe6f6f000-0x003fe6f74000 /tmp/TestSharedtsan_shared3507443847/001/libtsan_shared.so
0x003fe6f74000-0x003fe6f97000
0x003fe6f97000-0x003fe70b9000 /usr/lib/riscv64-linux-gnu/libtsan.so.2.0.0
0x003fe70b9000-0x003fe70be000 /usr/lib/riscv64-linux-gnu/libtsan.so.2.0.0
0x003fe70be000-0x003fe70c6000 /usr/lib/riscv64-linux-gnu/libtsan.so.2.0.0
0x003fe70c6000-0x003ff7fd6000
0x003ff7fd6000-0x003ff7fd9000
0x003ff7fd9000-0x003ff7fdb000 [vvar]
0x003ff7fdb000-0x003ff7fdc000 [vdso]
0x003ff7fdc000-0x003ff7ffc000 /usr/lib/riscv64-linux-gnu/ld-linux-riscv64-lp64d.so.1
0x003ff7ffc000-0x003ff7ffe000 /usr/lib/riscv64-linux-gnu/ld-linux-riscv64-lp64d.so.1
0x003ff7ffe000-0x003ff7fff000 /usr/lib/riscv64-linux-gnu/ld-linux-riscv64-lp64d.so.1
0x003ff7fff000-0x003ff8000000
0x003ffffde000-0x004000000000 [stack]
==63940==End of process memory map.
--- FAIL: TestTSAN (173.01s)
--- FAIL: TestTSAN/tsan (35.03s)
tsan_test.go:95: /usr/bin/setarch riscv64 -R /tmp/TestTSANtsan1239464039/001/tsan exited with exit status 66
```
see:
https://buildd.debian.org/status/fetch.php?pkg=golang-1.24&arch=riscv64&ver=1.24.4-3&stamp=1755794098&raw=0
From golang expert and here[0], it seems riscv64 race detector is not
support yet, but not sure which part trigger the test within uploading
recently or other packages. Ideally the test case will be skipped when
memory mapping is not match. Maybe we need to skip it explicitly?
I will test it with skipping the test case.
[0]: https://github.com/golang/go/issues/64345
I did some testing of this and found that it seems to work fine on a completely emulated riscv64 VM in QEMU, but on the real hardware that is the ricci porterbox I often got even worse than the buildds and hit segfaults instead that looked like the one in https://github.com/golang/go/issues/57691#issuecomment-2962825755 I was trying to figure out whether my -3 upload is what broke this, but I was ultimately unable to reproduce the same failure the buildds are having on either -3 *or* -1. For what it's worth, both gcc-12 version 12.4.0-8 and 12.5.0-1 were uploaded since the last successful buildd build of src:golang-1.24, so it's possible one of those is related too (the source of libtsan and the error message we're seeing in the tests). I don't think we're intentionally testing the race detector, and my upstream understanding was that they only test/support it on a limited set of architectures anyhow (and it would be surprising IMO for riscv64 to be one of those), but it's also extremely possible I don't know anything. :) https://github.com/golang/go/blob/go1.24.4/src/cmd/dist/test.go#L1677 ♥, - Tianon 4096R / B42F 6819 007F 00F8 8E36 4FD4 036A 9C25 BF35 7DD4
[...] yeah, qemu riscv64 on my system is sv57 and Unmatched(porterbox and buildd machines) is sv39. indeed. Very high probability is libtsan2_15.2.0-1 maybe... BR, Bo
Hi, Yep, I confirm that. The issue is reproducible in a trixie environment with only gcc-15-base and libtsan2 from forky. Building golang-1.24 with gcc-15 doesn't fix the issue, so it's not due to the version mismatch between the compiler and library. It rather seems to be a new feature or bug in libtsan2. Regards Aurelien
Hi, [...] I proposed the workaround to skip tsan tests on riscv64 explicitly in case block something. Certainly, I am thinking that how to report this to upstream. Tested it on Unmatched already, please have a review in your free time.
Control: clone -1 -2 Control: retitle -2 golang-1.25: FTBFS on riscv64: FATAL: ThreadSanitizer: memory layout is incompatible, even though ASLR is disabled Control: reassign -2 src:golang-1.25 Control: tags ftbfs,patch [...] https://buildd.debian.org/status/fetch.php?pkg=golang-1.25&arch=riscv64&ver=1.25.0-1&stamp=1757756223&raw=0 The diff can be appiled to golang-1.25 also. BR, Bo
Hi Shengjing! This https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1112166 is blockin golang-1.24 from migrating to testing. As the uploaded of this package for most of 2025, I wanted to check if you are planning to look into it? Overview: https://tracker.debian.org/teams/go-compiler/
Thanks for the patch! It's got a minor typo ("flasky" instead of
"flaky") which I was just going to fix and apply, but I've got some
further questions after looking deeper at the details/patch. 🙇
I also don't think it's accurate to call these tests "flaky" - they're
not passing sometimes, they literally fail all the time, so if
skipping them is the correct fix here we should come up with some
better wording for the error (and filename for the patch).
Am I correct in my understanding that this is actually a GCC bug?
When you say "report this to upstream", do you mean to GCC upstream?
Are the (Debian) GCC maintainers aware of the issue already too?
Looking at your patch headers, you mention the race detector, but I
don't think this is related to the race detector, right? As noted,
the race detector isn't supported on riscv64, so upstream's tests
wouldn't be testing it. I guess I'm a little concerned that maybe
this is going to leak beyond just the tests of Go itself, but I admit
I'm not familiar with TSAN at all or how/why it's used in Go.
In your skipping patches, you've imported "runtime", but both
functions you're adding it to already have a "goarch" variable that
they appear to be using in the same way as you've used
"runtime.GOARCH" - is there a particular reason you didn't just use
them? I'm guessing upstream had a good reason for not importing
"runtime" there.
My last question is how this relates to #1114841 ? Is it just a
coincidence that they're both riscv64 and gcc-15 related and they're
otherwise totally disparate issues?
♥,
- Tianon
4096R / B42F 6819 007F 00F8 8E36 4FD4 036A 9C25 BF35 7DD4
Hi, Thanks for your reviewing. :) Yeah, You are right, in fact I have a misunderstanding about flaky and skip in some content. For here, we did to *skip* the test cases on riscv64, it is not flaky. Here, I was trying to find what happened here. Unfortunately, I have not been able to reproduce the issue with a minimal test case yet. The failure was due to the GCC-15 update, but it is also possible that there are some problems with goaling's Tsan detection mechanism(let me call it here) on riscv64. So, before reporting it to the GCC Debian maintainer or upstream, I hope to get confirmation first from the Golang side, like[0] [0]: https://github.com/golang/go/issues/64345#issuecomment-3240634521 Yeah, my understanding is that the race detector currently doesn't support riscv64. Previously the gcc-14 would automatically detect the lack of support and skip it, but gcc-15 broke this rule. So I mentioned it there. Thanks for the pointer, It works. :) Both are coincidental, I have to apply these two patches to test the patch. For #1114841, it has blocked many go packages which was rebuilt recently, but golang-1.25[1] has fixed the issue, golang-1.24 has backported the commit from upstream[2]. So, golang-1.25/25 will have tsan test failed with gcc-15 on riscv64, and I think it is not perfect to skip it. But it will take some time to find the root cause. [1]: https://tracker.debian.org/pkg/golang-1.25 [2]: https://github.com/golang/go/issues/75351 BR, Bo
Hello, Bug #1112166 in golang reported by you has been fixed in the Git repository and is awaiting an upload. You can see the commit message below and you can check the diff of the fix at: https://salsa.debian.org/go-team/compiler/golang/-/commit/d852c2129ade815da703731182e959f7fee194d1 ------------------------------------------------------------------------ Apply Bo YU's riscv64 changes * Skip failing TSAN tests on riscv64 (Closes: #1112166) * Fix cgo on riscv64 internal linker issue (Closes: #1114841) (I made some minor edits to the supplied debdiff, especially after filing a dedicated Go upstream issue at https://go.dev/issue/75553; hopefully those are uncontroversial 💖) ------------------------------------------------------------------------ (this message was generated automatically) -- Greetings https://bugs.debian.org/1112166
We believe that the bug you reported is fixed in the latest version of golang-1.24, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to 1112166@bugs.debian.org, and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Bo YU <vimer@debian.org> (supplier of updated golang-1.24 package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org) Format: 1.8 Date: Fri, 19 Sep 2025 21:09:50 -0700 Source: golang-1.24 Architecture: source Version: 1.24.4-4 Distribution: unstable Urgency: medium Maintainer: Debian Go Compiler Team <team+go-compiler@tracker.debian.org> Changed-By: Bo YU <vimer@debian.org> Closes: 1112166 1114841 Changes: golang-1.24 (1.24.4-4) unstable; urgency=medium . * Skip failing TSAN tests on riscv64 (Closes: #1112166) * Fix cgo on riscv64 internal linker issue (Closes: #1114841) Checksums-Sha1: ac5bf6739946b8789c33ef8f8a09dcd0d984359c 2923 golang-1.24_1.24.4-4.dsc aa4e6654b0c2295a408a5176499a7dbf54367239 45344 golang-1.24_1.24.4-4.debian.tar.xz f8710672cdb536772a1a3880c98ff16ec921def1 5486 golang-1.24_1.24.4-4_source.buildinfo Checksums-Sha256: 29ffc85c1e64a2b9412d3e2319d1c4a80d63953a6807b4c1f76f32938fe807d1 2923 golang-1.24_1.24.4-4.dsc 6dacc7ea0da1ae0da306b6a056b26fbe1a28a7c76370c007f3cd645a8ded7137 45344 golang-1.24_1.24.4-4.debian.tar.xz 6f53976ba4688ca14fcf1906949e96fbc52a10d820dc94a21d2ef2f6bbfe0d72 5486 golang-1.24_1.24.4-4_source.buildinfo Files: 16b314a4350b2791b4f8084d942a47c9 2923 golang optional golang-1.24_1.24.4-4.dsc 47af70e847cda9795576a7948de7b696 45344 golang optional golang-1.24_1.24.4-4.debian.tar.xz ecd315f6ad376b896afb59ee7f8c73b8 5486 golang optional golang-1.24_1.24.4-4_source.buildinfo -----BEGIN PGP SIGNATURE----- iQJGBAEBCgAwFiEEtC9oGQB/APiONk/UA2qcJb81fdQFAmjOKVISHHRpYW5vbkBk ZWJpYW4ub3JnAAoJEANqnCW/NX3UqNEP/2VJCXfUIpoca0u/f6OKAJL0PSRb0i7q ZrhHZA+LsrmfJUXxVfvujYc7/DrHHShIn/Ou3tnnRFl9JpCcAKmI2Uz9onSeeyBB RS8d4d33sxdgiUl8kZpGHYtlTDYUVVb5Rj0HxuRNTQnCvNxS25OG+4bp0VCBjHKH ySIQiOzcdYMXECxpTmuwX52FGqmwYxr3EJY08yg2HMjnfiHEUgEOyISqJfsp1Xba dju4Nlv3uj0jZBzBt9GLd4Tq1qfI58i6MOaTpGuAbvlSXVHEAgIamHCVNOvyzPcr Y/MTVmUSuhkSUTX98+Tlx9SwFpvAA4ylRCkI9LIWJzxqjS7yju6X15vmzQgBxXei ptH6pSt5p8s7efSzXsF7NX7cQBY32sbGUp0UurOKwX6x2d4WvzXAFV2VWTsjeuea k20aCrvmY2orZjk82g9r2RR47y5tf+hkgwyIyWloyXgPsrsPq5747sUC1LlobUcz +WSHao9CyaBhuF2HAKfrt8I4pWglTWFogTakt8EwJOrgM2UfFRQMRMrF761P/fxl sYxeKIwZj+Pdy9evxBx7ygTNPyWicG+PxOfj+luuVJwUbEKZ1zVVL+w1f47XSm2V WbitkxGeC/kV/nQXeqiR6ewvvAXnsIxF2UD6XQCLcRC8kgVrDsoIrJS9d4ynSpqL YQPkabxXzSr1 =/i7K -----END PGP SIGNATURE-----