Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-61245

crypto TestPureGoTag segfaults when using -exec valgrind on aarch64

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-10.0
    • golang
    • No
    • None
    • rhel-sst-pt-llvm-rust-go
    • ssg_platform_tools
    • 2
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • aarch64
    • None

      TestPureGoTag from crypto internal testsuite segfaults when executing under valgrind (using -exec 'valgrind ...') with golang-1.23.1-2.el10 on RHEL-10.0-20240929.1 aarch64 and x86_64:

      [root@ampere-mtsnow-altra-02-vm-08 ~]# rpm -qa valgrind
      valgrind-3.23.0-4.el10.aarch64
      [root@ampere-mtsnow-altra-02-vm-08 ~]# rpm -qa golang
      golang-1.23.1-2.el10.aarch64
      [root@ampere-mtsnow-altra-02-vm-08 ~]# GOLANG_FIPS=1 go test crypto -timeout 50m -count=1 -v -run ^TestPureGoTag$ -exec 'valgrind --trace-children=yes --track-origins=yes --leak-check=full --fair-sched=try'
      ==19034== Memcheck, a memory error detector
      ==19034== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
      ==19034== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
      ==19034== Command: /tmp/go-build173966279/b001/crypto.test -test.paniconexit0 -test.timeout=50m0s -test.count=1 -test.v=true -test.run=^TestPureGoTag$
      ==19034== 
      ==19034== Invalid write of size 8
      ==19034==    at 0x475944: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034==  Address 0x1ffefffbb8 is on thread 1's stack
      ==19034==  8 bytes below stack pointer
      ==19034== 
      (...)
      ==19034== 
      ==19034== Invalid read of size 8
      ==19034==    at 0x47F1EC: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034==  Address 0x400005fac8 is in a rw- anonymous segment
      ==19034== 
      ==19034== Invalid read of size 8
      ==19034==    at 0x47E678: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034==  Address 0x400005fb08 is in a rw- anonymous segment
      ==19034== 
      ==19034== 
      ==19034== More than 1000 different errors detected.  I'm not reporting any more.
      ==19034== Final error counts will be inaccurate.  Go fix your program!
      ==19034== Rerun with --error-limit=no to disable this cutoff.  Note
      ==19034== that errors may occur in your program without prior warning from
      ==19034== Valgrind, because errors are no longer being displayed.
      ==19034== 
      === RUN   TestPureGoTag
      --19034-- WARNING: unhandled arm64-linux syscall: 424
      --19034-- You may be able to write your own handler.
      --19034-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
      --19034-- Nevertheless we consider this a bug.  Please report
      --19034-- it at http://valgrind.org/support/bug_reports.html.
      ==19053== Memcheck, a memory error detector
      ==19053== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
      ==19053== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
      ==19053== Command: /usr/lib/golang/bin/go list -e crypto/... math/big
      ==19053== 
      ==19053== Invalid write of size 8
      ==19053==    at 0x4792F4: runtime.rt0_go.abi0 (asm_arm64.s:11)
      ==19053==  Address 0x1fff000b98 is on thread 1's stack
      ==19053==  8 bytes below stack pointer
      ==19053== 
      (...)
      ==19077== 
      ==19077== Invalid write of size 8
      ==19077==    at 0x40260: runtime.getproccount (os_linux.go:97)
      ==19077==    by 0x40A4B: runtime.osinit (os_linux.go:344)
      ==19077==    by 0x7EEDF: runtime.rt0_go.abi0 (asm_arm64.s:85)
      ==19077==  Address 0x1ffeffda88 is not stack'd, malloc'd or (recently) free'd
      ==19077== 
      ==19077== 
      ==19077== Process terminating with default action of signal 11 (SIGSEGV): dumping core
      ==19077==  Access not within mapped region at address 0x1FFEFFDA88
      ==19077==    at 0x40260: runtime.getproccount (os_linux.go:97)
      ==19077==    by 0x40A4B: runtime.osinit (os_linux.go:344)
      ==19077==    by 0x7EEDF: runtime.rt0_go.abi0 (asm_arm64.s:85)
      ==19077==  If you believe this happened as a result of a stack
      ==19077==  overflow in your program's main thread (unlikely but
      ==19077==  possible), you can try to increase the size of the
      ==19077==  main thread stack using the --main-stacksize= flag.
      ==19077==  The main thread stack size used in this run was 8388608.
      ==19077== 
      ==19077== HEAP SUMMARY:
      ==19077==     in use at exit: 0 bytes in 0 blocks
      ==19077==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
      ==19077== 
      ==19077== All heap blocks were freed -- no leaks are possible
      ==19077== 
      ==19077== For lists of detected and suppressed errors, rerun with: -s
      ==19077== ERROR SUMMARY: 60 errors from 18 contexts (suppressed: 0 from 0)
      go tool dist: signal: segmentation fault (core dumped)
      ==19067== 
      ==19067== HEAP SUMMARY:
      ==19067==     in use at exit: 172,465 bytes in 3,839 blocks
      ==19067==   total heap usage: 25,309 allocs, 21,470 frees, 2,473,051 bytes allocated
      ==19067== 
      ==19067== 288 bytes in 1 blocks are possibly lost in loss record 802 of 902
      ==19067==    at 0x488C7C8: calloc (vg_replace_malloc.c:1675)
      ==19067==    by 0x400F897: UnknownInlinedFun (rtld-malloc.h:44)
      ==19067==    by 0x400F897: allocate_dtv (dl-tls.c:370)
      ==19067==    by 0x40102F3: _dl_allocate_tls (dl-tls.c:629)
      ==19067==    by 0x497AA7F: pthread_create@@GLIBC_2.34 (in /usr/lib64/libc.so.6)
      ==19067==    by 0x977DF3: _cgo_try_pthread_create (gcc_libinit.c:154)
      ==19067==    by 0x977F6F: _cgo_sys_thread_start (gcc_linux_arm64.c:34)
      ==19067==    by 0x47B79B: runtime.asmcgocall.abi0 (asm_arm64.s:1000)
      ==19067==    by 0x40000021BF: ???
      ==19067== 
      ==19067== 1,728 bytes in 6 blocks are possibly lost in loss record 881 of 902
      ==19067==    at 0x488C7C8: calloc (vg_replace_malloc.c:1675)
      ==19067==    by 0x400F897: UnknownInlinedFun (rtld-malloc.h:44)
      ==19067==    by 0x400F897: allocate_dtv (dl-tls.c:370)
      ==19067==    by 0x40102F3: _dl_allocate_tls (dl-tls.c:629)
      ==19067==    by 0x497AA7F: pthread_create@@GLIBC_2.34 (in /usr/lib64/libc.so.6)
      ==19067==    by 0x977DF3: _cgo_try_pthread_create (gcc_libinit.c:154)
      ==19067==    by 0x977F6F: _cgo_sys_thread_start (gcc_linux_arm64.c:34)
      ==19067==    by 0x47B7E7: runtime.asmcgocall.abi0 (asm_arm64.s:1032)
      ==19067==    by 0xFFFFFFFFFFFFFFFF: ???
      ==19067== 
      ==19067== LEAK SUMMARY:
      ==19067==    definitely lost: 0 bytes in 0 blocks
      ==19067==    indirectly lost: 0 bytes in 0 blocks
      ==19067==      possibly lost: 2,016 bytes in 7 blocks
      ==19067==    still reachable: 170,449 bytes in 3,832 blocks
      ==19067==         suppressed: 0 bytes in 0 blocks
      ==19067== Reachable blocks (those to which a pointer was found) are not shown.
      ==19067== To see them, rerun with: --leak-check=full --show-leak-kinds=all
      ==19067== 
      ==19067== For lists of detected and suppressed errors, rerun with: -s
      ==19067== ERROR SUMMARY: 10063 errors from 1002 contexts (suppressed: 0 from 0)
      2024/10/02 07:17:18 loading architecture list: exit status 1
      ==19034== 
      ==19034== HEAP SUMMARY:
      ==19034==     in use at exit: 172,177 bytes in 3,838 blocks
      ==19034==   total heap usage: 25,241 allocs, 21,403 frees, 2,461,268 bytes allocated
      ==19034== 
      ==19034== 288 bytes in 1 blocks are possibly lost in loss record 802 of 902
      ==19034==    at 0x488C7C8: calloc (vg_replace_malloc.c:1675)
      ==19034==    by 0x400F897: UnknownInlinedFun (rtld-malloc.h:44)
      ==19034==    by 0x400F897: allocate_dtv (dl-tls.c:370)
      ==19034==    by 0x40102F3: _dl_allocate_tls (dl-tls.c:629)
      ==19034==    by 0x494AA7F: pthread_create@@GLIBC_2.34 (in /usr/lib64/libc.so.6)
      ==19034==    by 0x57B373: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034==    by 0x57B4EF: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034==    by 0x477DEB: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034== 
      ==19034== 1,440 bytes in 5 blocks are possibly lost in loss record 877 of 902
      ==19034==    at 0x488C7C8: calloc (vg_replace_malloc.c:1675)
      ==19034==    by 0x400F897: UnknownInlinedFun (rtld-malloc.h:44)
      ==19034==    by 0x400F897: allocate_dtv (dl-tls.c:370)
      ==19034==    by 0x40102F3: _dl_allocate_tls (dl-tls.c:629)
      ==19034==    by 0x494AA7F: pthread_create@@GLIBC_2.34 (in /usr/lib64/libc.so.6)
      ==19034==    by 0x57B373: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034==    by 0x57B4EF: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034==    by 0x477E37: ??? (in /tmp/go-build173966279/b001/crypto.test)
      ==19034== 
      ==19034== LEAK SUMMARY:
      ==19034==    definitely lost: 0 bytes in 0 blocks
      ==19034==    indirectly lost: 0 bytes in 0 blocks
      ==19034==      possibly lost: 1,728 bytes in 6 blocks
      ==19034==    still reachable: 170,449 bytes in 3,832 blocks
      ==19034==         suppressed: 0 bytes in 0 blocks
      ==19034== Reachable blocks (those to which a pointer was found) are not shown.
      ==19034== To see them, rerun with: --leak-check=full --show-leak-kinds=all
      ==19034== 
      ==19034== For lists of detected and suppressed errors, rerun with: -s
      ==19034== ERROR SUMMARY: 16413 errors from 1002 contexts (suppressed: 0 from 0)
      FAIL	crypto	31.189s
      FAIL
      

      The test passes when executed plainly (without valgrind), hence this is possibly a valgrind issue.
      The test was added on go1.23, so is not available on previous versions.

              rh-ee-deparker Derek Parker
              rhn-support-emachado Edjunior Machado
              David Benoit David Benoit
              Edjunior Machado Edjunior Machado
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated: