https://bugs.kde.org/show_bug.cgi?id=497236

            Bug ID: 497236
           Summary: memcheck support for golang binaries
    Classification: Developer tools
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Running any golang created binary causes a lot memcheck errors:

$ cat hello.go 
package main
import "fmt"
func main() {
    fmt.Println("hello world")
}

$ go build hello.go

$ valgrind ./hello
==14100== Memcheck, a memory error detector
==14100== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==14100== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info
==14100== Command: ./hello
==14100== 
==14100== Warning: set address range perms: large range [0x9160000, 0x29160000)
(noaccess)
==14100== Warning: set address range perms: large range [0x29160000,
0x49160000) (noaccess)
==14100== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==14100==          the SIGRT32 signal is used internally by Valgrind
==14100== Warning: client switching stacks?  SP change: 0x1ffefff6e8 -->
0xc0000687d8
==14100==          to suppress, use: --max-stackframe=687211974896 or greater
==14100== Warning: client switching stacks?  SP change: 0xc000068740 -->
0x1ffefff798
==14100==          to suppress, use: --max-stackframe=687211974568 or greater
==14100== Warning: client switching stacks?  SP change: 0x1ffefff798 -->
0xc000068740
==14100==          to suppress, use: --max-stackframe=687211974568 or greater
==14100==          further instances of this message will not be shown.
==14100== Thread 4:
==14100== Conditional jump or move depends on uninitialised value(s)
==14100==    at 0x460DF4: runtime.mallocgc (malloc.go:1041)
==14100==    by 0x40C8A4: runtime.newobject (malloc.go:1386)
==14100==    by 0x41E719: runtime.(*scavengerState).init (mgcscavenge.go:363)
==14100==    by 0x41EE3E: runtime.bgscavenge (mgcscavenge.go:650)
==14100==    by 0x4157E4: runtime.gcenable.gowrap2 (mgc.go:204)
==14100==    by 0x46B940: runtime.goexit.abi0 (asm_amd64.s:1700)
[...]
==14100== Invalid read of size 8
==14100==    at 0x469B05: runtime.systemstack.abi0 (asm_amd64.s:513)
==14100==  Address 0xc000069ee0 is on thread 4's stack
==14100==  139496 bytes below stack pointer
==14100== 
==14100== Use of uninitialised value of size 8
==14100==    at 0x405860: runtime.send.goready.func1 (proc.go:444)
==14100== 
==14100== Invalid read of size 8
==14100==    at 0x40586E: runtime.send.goready.func1 (proc.go:444)
==14100==  Address 0xc000069ef0 is on thread 4's stack
==14100==  139440 bytes below stack pointer
==14100== 
==14100== Invalid read of size 8
==14100==    at 0x405872: runtime.send.goready.func1 (proc.go:444)
==14100==  Address 0xc000069ee8 is on thread 4's stack
==14100==  139448 bytes below stack pointer
==14100== 
==14100== Use of uninitialised value of size 8
==14100==    at 0x405880: runtime.send.goready.func1 (proc.go:445)
[...]
==13786== ERROR SUMMARY: 691 errors from 381 contexts (suppressed: 0 from 0)

There are a couple of issues that make it hard to support compiled go binaries.
They use static linking, a garbage collector and goroutines switch stacks.

Also on ppc64le it seems that if there is any signal interruption valgrind
crashes.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to