Skip to content

cmd/cgo: (on riscv64 with gcc-15) FATAL: ThreadSanitizer: memory layout is incompatible, even though ASLR is disabled. #75553

@tianon

Description

@tianon

fyi, golang-1.24 reproduced the issue with gcc-15, but before reporting this to gcc, I want to confirm whether this is expected from the golang side or not.

Originally posted by @yuzibo in #64345

This is probably a gcc bug (from the messaging libtsan is spitting out), but just in case it's actually a Go bug, we wanted to start by reporting it to Go first. 🙇

On riscv64 with gcc-15, we're seeing test failures in the testsanitizers tests TestTSAN and TestShared that look like this:

--- 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-riscvIssues solely affecting the riscv64 architecture.compiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

    Type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions