Skip to content
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

Open
zhsj opened this issue Jan 9, 2023 · 6 comments
Open

runtime: TestASAN fails with SEGV on unknown address on linux/riscv64 #57691

zhsj opened this issue Jan 9, 2023 · 6 comments
Assignees
Labels
arch-riscv Issues solely affecting the riscv64 architecture. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Linux
Milestone

Comments

@zhsj
Copy link
Contributor

zhsj commented Jan 9, 2023

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:

##### ../misc/cgo/testsanitizers
--- FAIL: TestASANLinkerX (50.78s)
    asan_test.go:140: /tmp/.3038941009/main.exe exited with exit status 1
        AddressSanitizer:DEADLYSIGNAL
        =================================================================
        ==2229782==ERROR: AddressSanitizer: SEGV on unknown address 0x00081a64f740 (pc 0x00000006b860 bp 0x003fd327bad0 sp 0x003fd327b9c0 T0)
        ==2229782==The signal is caused by a WRITE memory access.
            #0 0x6b860 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
            #1 0x63c9a in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
        
        AddressSanitizer can not provide additional info.
        SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
        ==2229782==ABORTING
--- FAIL: TestASAN (194.40s)
    --- FAIL: TestASAN/asan_unsafe_fail3 (8.81s)
        asan_test.go:95: `/tmp/TestASAN2813184920/asan_unsafe_fail3` exited without expected memory access error
            use-after-poison; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2231530==ERROR: AddressSanitizer: SEGV on unknown address 0x00081bcbc93c (pc 0x000000125260 bp 0x003fde5e4ab0 sp 0x003fde5e49a0 T0)
            ==2231530==The signal is caused by a WRITE memory access.
                #0 0x125260 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b2c2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2231530==ABORTING
    --- FAIL: TestASAN/asan_global5 (9.76s)
        asan_test.go:97: /tmp/TestASAN3609951685/asan_global5 exited with exit status 1
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2231586==ERROR: AddressSanitizer: SEGV on unknown address 0x00081cf5e33c (pc 0x000000125618 bp 0x003fe7af1ac0 sp 0x003fe7af19b0 T0)
            ==2231586==The signal is caused by a WRITE memory access.
                #0 0x125618 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b2c2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2231586==ABORTING
    --- FAIL: TestASAN/asan1_fail (11.94s)
        asan_test.go:95: `/tmp/TestASAN54641818/asan1_fail` exited without expected memory access error
            heap-use-after-free; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2231676==ERROR: AddressSanitizer: SEGV on unknown address 0x00081f368f3c (pc 0x000000125a1a bp 0x003ff9b47ac0 sp 0x003ff9b479b0 T0)
            ==2231676==The signal is caused by a WRITE memory access.
                #0 0x125a1a in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b402 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2231676==ABORTING
    --- FAIL: TestASAN/asan_unsafe_fail2 (7.88s)
        asan_test.go:95: `/tmp/TestASAN2421896259/asan_unsafe_fail2` exited without expected memory access error
            use-after-poison; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2231779==ERROR: AddressSanitizer: SEGV on unknown address 0x00081955bd3c (pc 0x0000001252e0 bp 0x003fcaadeab0 sp 0x003fcaade9a0 T0)
            ==2231779==The signal is caused by a WRITE memory access.
                #0 0x1252e0 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b2c2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2231779==ABORTING
    --- FAIL: TestASAN/asan5_fail (9.05s)
        asan_test.go:95: `/tmp/TestASAN2780092511/asan5_fail` exited without expected memory access error
            use-after-poison; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2231781==ERROR: AddressSanitizer: SEGV on unknown address 0x00081afcc53c (pc 0x0000001274a8 bp 0x003fd7e62ac0 sp 0x003fd7e629b0 T0)
            ==2231781==The signal is caused by a WRITE memory access.
                #0 0x1274a8 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b2c2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2231781==ABORTING
    --- FAIL: TestASAN/asan_unsafe_fail1 (10.89s)
        asan_test.go:95: `/tmp/TestASAN121050683/asan_unsafe_fail1` exited without expected memory access error
            use-after-poison; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2231946==ERROR: AddressSanitizer: SEGV on unknown address 0x00081e9f6f3c (pc 0x0000001252e0 bp 0x003ff4fb7ab0 sp 0x003ff4fb79a0 T0)
            ==2231946==The signal is caused by a WRITE memory access.
                #0 0x1252e0 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b2c2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2231946==ABORTING
    --- FAIL: TestASAN/asan3_fail (10.66s)
        asan_test.go:95: `/tmp/TestASAN781659404/asan3_fail` exited without expected memory access error
            use-after-poison; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232076==ERROR: AddressSanitizer: SEGV on unknown address 0x00081cfe473c (pc 0x000000070a10 bp 0x003fe7f23ac0 sp 0x003fe7f239b0 T0)
            ==2232076==The signal is caused by a WRITE memory access.
                #0 0x70a10 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6420a in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232076==ABORTING
    --- FAIL: TestASAN/asan_useAfterReturn (12.69s)
        asan_test.go:97: /tmp/TestASAN2805664159/asan_useAfterReturn exited with exit status 1
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232146==ERROR: AddressSanitizer: SEGV on unknown address 0x00081ecb293c (pc 0x0000001277a0 bp 0x003ff6594ab0 sp 0x003ff65949a0 T0)
            ==2232146==The signal is caused by a WRITE memory access.
                #0 0x1277a0 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b2c2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232146==ABORTING
    --- FAIL: TestASAN/asan4_fail (9.07s)
        asan_test.go:95: `/tmp/TestASAN4279481713/asan4_fail` exited without expected memory access error
            use-after-poison; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232245==ERROR: AddressSanitizer: SEGV on unknown address 0x000818ffc53c (pc 0x000000070a64 bp 0x003fc7fe2ac0 sp 0x003fc7fe29b0 T0)
            ==2232245==The signal is caused by a WRITE memory access.
                #0 0x70a64 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6426a in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232245==ABORTING
    --- FAIL: TestASAN/asan_global4_fail (8.92s)
        asan_test.go:95: `/tmp/TestASAN3022414010/asan_global4_fail` exited without expected memory access error
            global-buffer-overflow; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232484==ERROR: AddressSanitizer: SEGV on unknown address 0x00081d6ff33c (pc 0x000000127ad0 bp 0x003feb7f9ab0 sp 0x003feb7f99a0 T0)
            ==2232484==The signal is caused by a WRITE memory access.
                #0 0x127ad0 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b2c2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232484==ABORTING
    --- FAIL: TestASAN/asan_global3_fail (12.80s)
        asan_test.go:95: `/tmp/TestASAN3708145155/asan_global3_fail` exited without expected memory access error
            global-buffer-overflow; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232582==ERROR: AddressSanitizer: SEGV on unknown address 0x00081ba49b3c (pc 0x000000127fdc bp 0x003fdd24dab0 sp 0x003fdd24d9a0 T0)
            ==2232582==The signal is caused by a WRITE memory access.
                #0 0x127fdc in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b432 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232582==ABORTING
    --- FAIL: TestASAN/asan_global2_fail (10.94s)
        asan_test.go:95: `/tmp/TestASAN2939476675/asan_global2_fail` exited without expected memory access error
            global-buffer-overflow; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232708==ERROR: AddressSanitizer: SEGV on unknown address 0x000819db6f3c (pc 0x0000001266ac bp 0x003fcedb7ab0 sp 0x003fcedb79a0 T0)
            ==2232708==The signal is caused by a WRITE memory access.
                #0 0x1266ac in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6bc8a in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232708==ABORTING
    --- FAIL: TestASAN/arena_fail (47.49s)
        asan_test.go:95: `/tmp/TestASAN3425815187/arena_fail` exited without expected memory access error
            use-after-poison; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232833==ERROR: AddressSanitizer: SEGV on unknown address 0x00081cffe33c (pc 0x00000006dd90 bp 0x003fe7ff1ac0 sp 0x003fe7ff19b0 T0)
            ==2232833==The signal is caused by a WRITE memory access.
                #0 0x6dd90 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x669e2 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232833==ABORTING
    --- FAIL: TestASAN/asan2_fail (10.10s)
        asan_test.go:95: `/tmp/TestASAN2122599923/asan2_fail` exited without expected memory access error
            heap-buffer-overflow; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232842==ERROR: AddressSanitizer: SEGV on unknown address 0x00081ca76d3c (pc 0x000000127d2c bp 0x003fe53b6ac0 sp 0x003fe53b69b0 T0)
            ==2232842==The signal is caused by a WRITE memory access.
                #0 0x127d2c in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b462 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232842==ABORTING
    --- FAIL: TestASAN/asan_global1_fail (8.87s)
        asan_test.go:95: `/tmp/TestASAN1995782410/asan_global1_fail` exited without expected memory access error
            global-buffer-overflow; got failure
            AddressSanitizer:DEADLYSIGNAL
            =================================================================
            ==2232843==ERROR: AddressSanitizer: SEGV on unknown address 0x00081c4ce53c (pc 0x000000125e30 bp 0x003fe2672ab0 sp 0x003fe26729a0 T0)
            ==2232843==The signal is caused by a WRITE memory access.
                #0 0x125e30 in x_cgo_init /_/runtime/cgo/gcc_linux_riscv64.c:56
                #1 0x6b432 in runtime.rt0_go /usr/lib/go-1.20/src/runtime/asm_riscv64.s:34
            
            AddressSanitizer can not provide additional info.
            SUMMARY: AddressSanitizer: SEGV /_/runtime/cgo/gcc_linux_riscv64.c:56 in x_cgo_init
            ==2232843==ABORTING
FAIL

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.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 9, 2023
@mengzhuo mengzhuo added arch-riscv Issues solely affecting the riscv64 architecture. OS-Linux and removed arch-riscv Issues solely affecting the riscv64 architecture. labels Jan 9, 2023
@mengzhuo
Copy link
Contributor

mengzhuo commented Jan 9, 2023

cc @golang/riscv64
It looks real problem to me.
p.s. The linux/riscv builders are using Ubuntu 21.04 without llvm, all the asan related tests are skipped.

@cagedmantis cagedmantis added this to the Go1.20 milestone Jan 9, 2023
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 9, 2023
@bcmills
Copy link
Member

bcmills commented Jan 9, 2023

Looks like this test was enabled for riscv64 in CL 375256 (Go 1.19).

@bcmills bcmills modified the milestones: Go1.20, Go1.21 Jan 9, 2023
@zhsj
Copy link
Contributor Author

zhsj commented Jan 9, 2023

Looks like this test was enabled for riscv64 in CL 375256 (Go 1.19).

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

@cherrymui
Copy link
Member

What version of the C compiler are you using? Thanks.

@zhsj
Copy link
Contributor Author

zhsj commented Jan 12, 2023

What version of the C compiler are you using? Thanks.

gcc-12 on Debian unstable. https://tracker.debian.org/pkg/gcc-12

@yuzibo
Copy link

yuzibo commented Jan 14, 2023

Hi,
If I am doing correctly, I git bisect got:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-riscv Issues solely affecting the riscv64 architecture. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Linux
Projects
Status: Todo
Development

No branches or pull requests

8 participants