-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
runtime: TestASAN fails with SEGV on unknown address on linux/riscv64 #57691
Comments
cc @golang/riscv64 |
Looks like this test was enabled for |
Then there's something broken. We can build Go 1.19 before. https://buildd.debian.org/status/logs.php?pkg=golang-1.19&arch=riscv64 |
What version of the C compiler are you using? Thanks. |
gcc-12 on Debian unstable. https://tracker.debian.org/pkg/gcc-12 |
Hi, vimer@dev-rv-unmatched:~/build/go/go$ git bisect good
dfbecc06e73b79aaeee4220b3e760cbd76050ae5 is the first bad commit
commit dfbecc06e73b79aaeee4220b3e760cbd76050ae5
Author: Archana R <aravind5@in.ibm.com>
Date: Wed Aug 10 09:57:51 2022 -0500
misc/cgo/testsanitizers: fix code to detect gcc version correctly
The current implementation of compilerVersion incorrectly gives an
error message that the compiler version is too old even though the
system has a recent compiler. This happens for specifically for the
gcc compiler and causes ASAN tests to be skipped.
Replacing -v with gcc dump version options seems to fix it. Running
./testsanitizers.test -test.v now shows the ASAN tests being run.
--- PASS: TestASAN (16.81s)
--- PASS: TestASAN/asan_useAfterReturn (0.60s)
--- PASS: TestASAN/asan_global5 (0.61s)
--- PASS: TestASAN/asan_unsafe_fail1 (0.73s)
--- PASS: TestASAN/asan_unsafe_fail3 (0.73s)
--- PASS: TestASAN/asan_unsafe_fail2 (0.74s)
--- PASS: TestASAN/asan_global4_fail (0.74s)
--- PASS: TestASAN/asan5_fail (0.74s)
--- PASS: TestASAN/asan3_fail (0.88s)
--- PASS: TestASAN/asan4_fail (0.89s)
--- PASS: TestASAN/asan2_fail (0.99s)
--- PASS: TestASAN/asan_global3_fail (1.00s)
--- PASS: TestASAN/asan_global1_fail (1.01s)
--- PASS: TestASAN/asan1_fail (1.01s)
--- PASS: TestASAN/asan_global2_fail (1.02s)
PASS
Fixes #54370
Change-Id: Iac13a1cf37de54432a6e49555f61e9ec1d781ab8
Reviewed-on: https://go-review.googlesource.com/c/go/+/422574
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
misc/cgo/testsanitizers/cc_test.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-) My real riscv64 hardware is Unmatched also: vimer@dev-rv-unmatched:~/build/go/go/src$ uname -a
Linux dev-rv-unmatched 6.1.0-1-riscv64 #1 SMP Debian 6.1.4-1 (2023-01-07) riscv64 GNU/Linux |
@yuzibo I don't think it is the bad commit, it just enabled the tests. I can reproduce with go1.19.5 on my riscv64 hardware.
|
I can confirm gcc-12 is the culprit, gcc 11 passed all the tests. Why asan accessing an unknown memory? Here is the gcc12 build binary
|
@zhsj This might be a bug from libasan8. asan 12.2.0 using SHADOW_OFFSET by 0xd55550000 static const u64 kRiscv64_ShadowOffset64 = 0xd55550000;
...
#elif SANITIZER_RISCV64
#define SHADOW_OFFSET kRiscv64_ShadowOffset64
...
#define MEM_TO_SHADOW(mem) (((mem) >> SHADOW_SCALE) + (SHADOW_OFFSET)) this should be However I found that libasan8's SHADOW_OFFSET is 0x20000
|
Found new dashboard test flakes for:
2023-02-10 19:39 linux-riscv64-unmatched go@88ad4476 misc/cgo/testsanitizers.TestASANLinkerX (log)
2023-02-10 19:39 linux-riscv64-unmatched go@88ad4476 misc/cgo/testsanitizers.TestASAN (log)
2023-02-10 21:19 linux-riscv64-unmatched go@117d5588 misc/cgo/testsanitizers.TestASANLinkerX (log)
2023-02-10 21:19 linux-riscv64-unmatched go@117d5588 misc/cgo/testsanitizers.TestASAN (log)
2023-02-10 22:09 linux-riscv64-unmatched go@5c5f8dc9 misc/cgo/testsanitizers.TestASANLinkerX (log)
2023-02-10 22:09 linux-riscv64-unmatched go@5c5f8dc9 misc/cgo/testsanitizers.TestASAN (log)
2023-02-13 19:16 linux-riscv64-unmatched go@505325cf misc/cgo/testsanitizers.TestASANLinkerX (log)
2023-02-13 19:16 linux-riscv64-unmatched go@505325cf misc/cgo/testsanitizers.TestASAN (log)
2023-03-07 21:29 linux-riscv64-unmatched go@b675a75c misc/cgo/testsanitizers.TestASANLinkerX (log)
2023-03-07 21:29 linux-riscv64-unmatched go@b675a75c misc/cgo/testsanitizers.TestASAN (log)
2023-03-07 22:52 linux-riscv64-unmatched go@457fd1d5 misc/cgo/testsanitizers.TestASANLinkerX (log)
2023-03-07 22:52 linux-riscv64-unmatched go@457fd1d5 misc/cgo/testsanitizers.TestASAN (log)
|
I was investigating this issue and found This issue is fixed in gcc-mirror/gcc@21a0762 (one day before I discovered the issue and gcc-mirror then was out-of-date), and all Go tests passed with cherry-picked GCC 13.1.1 on Arch Linux riscv64. Sorry for the late response. Thanks @mengzhuo and @yuzibo for their help, and @andreas-schwab for fixing. The issue may be closed now unless I missed something. |
Fix libasan error for downstream projects such as Go. Discussion: golang/go#57691
Fix libasan error for downstream projects such as Go. Discussion: golang/go#57691
Confirmed. It's also fixed in gcc 12. |
Found new dashboard test flakes for:
2023-08-23 21:37 linux-riscv64-unmatched go@27631460 cmd/cgo/internal/testsanitizers.TestASANLinkerX (log)
2023-08-23 21:37 linux-riscv64-unmatched go@27631460 cmd/cgo/internal/testsanitizers.TestASAN (log)
|
The libasan of debian port is not fixed in 20221225T084846Z, I will lock the version of libasan in visionfive2 builder. Closed. |
Found new dashboard test flakes for:
2023-09-05 16:41 linux-riscv64-unmatched go@a40404da cmd/cgo/internal/testsanitizers.TestASANLinkerX (log)
2023-09-05 16:41 linux-riscv64-unmatched go@a40404da cmd/cgo/internal/testsanitizers.TestASAN (log)
|
Building 1.20rc2 on Debian.
https://buildd.debian.org/status/fetch.php?pkg=golang-1.20&arch=riscv64&ver=1.20%7Erc2-1&stamp=1673197738&raw=0
https://buildd.debian.org/status/fetch.php?pkg=golang-1.20&arch=riscv64&ver=1.20%7Erc2-1&stamp=1673210057&raw=0
Tried twice, both fail with:
It's built with go 1.19.4.
Kernel is
Linux 6.0.0-3-riscv64 #1 SMP Debian 6.0.7-1 (2022-11-05) riscv64 (riscv64)
I think it's HiFive Unmatched board.
The text was updated successfully, but these errors were encountered: