Bug 2064892

Summary: some go tests fail when using -exec valgrind on aarch64, ppc64le and s390x
Product: Red Hat Enterprise Linux 9 Reporter: Edjunior Barbosa Machado <emachado>
Component: golangAssignee: David Benoit <dbenoit>
Status: NEW --- QA Contact: Edjunior Barbosa Machado <emachado>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: asm, dbenoit, emachado, sipoyare, tstellar
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Edjunior Barbosa Machado 2022-03-16 19:44:41 UTC
Description of problem:
Some go tests that pass when executed plainly fail when using '-exec valgrind' on rhel-9 aarch64 and s390x:

[root@hpe-apollo-cn99xx-15-vm-27 ~]# OPENSSL_FORCE_FIPS_MODE=1 GOLANG_FIPS=1 go test -count=1 -v -v -v crypto/des -run ^TestWeakKeys$ 
=== RUN   TestWeakKeys
--- PASS: TestWeakKeys (0.00s)
PASS
ok  	crypto/des	0.014s
[root@hpe-apollo-cn99xx-15-vm-27 ~]# OPENSSL_FORCE_FIPS_MODE=1 GOLANG_FIPS=1 go test -count=1 -v -v -v crypto/des -run ^TestWeakKeys$ -exec valgrind 
==153912== Memcheck, a memory error detector
==153912== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==153912== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==153912== Command: /tmp/go-build1096396586/b001/des.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 -test.v=true -test.v=true -test.v=true -test.run=^TestWeakKeys$
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x75C84: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffcd8 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x59294: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffc78 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x58F74: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffc58 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid read of size 8
==153912==    at 0x59170: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffc58 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid read of size 8
==153912==    at 0x59608: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffc78 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 4
==153912==    at 0x75D10: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffcb8 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x58BC4: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffc98 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x41D74: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefff840 is on thread 1's stack
==153912==  1120 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x41D7C: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefff838 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x41FB4: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefff808 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x72214: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefff768 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid read of size 8
==153912==    at 0x72294: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefff768 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid read of size 8
==153912==    at 0x420B0: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefff808 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid read of size 8
==153912==    at 0x41EE0: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefff838 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Use of uninitialised value of size 8
==153912==    at 0x41EE4: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912== 
==153912== Invalid read of size 8
==153912==    at 0x58C20: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffc98 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x42224: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffefffc98 is on thread 1's stack
==153912==  8 bytes below stack pointer
==153912== 
==153912== Invalid write of size 8
==153912==    at 0x41A90: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  Address 0x1ffeffdc70 is not stack'd, malloc'd or (recently) free'd
==153912== 
==153912== 
==153912== Process terminating with default action of signal 11 (SIGSEGV)
==153912==  Access not within mapped region at address 0x1FFEFFDC70
==153912==    at 0x41A90: ??? (in /tmp/go-build1096396586/b001/des.test)
==153912==  If you believe this happened as a result of a stack
==153912==  overflow in your program's main thread (unlikely but
==153912==  possible), you can try to increase the size of the
==153912==  main thread stack using the --main-stacksize= flag.
==153912==  The main thread stack size used in this run was 8388608.
==153912== 
==153912== HEAP SUMMARY:
==153912==     in use at exit: 0 bytes in 0 blocks
==153912==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==153912== 
==153912== All heap blocks were freed -- no leaks are possible
==153912== 
==153912== Use --track-origins=yes to see where uninitialised values come from
==153912== For lists of detected and suppressed errors, rerun with: -s
==153912== ERROR SUMMARY: 56 errors from 18 contexts (suppressed: 0 from 0)
FAIL	crypto/des	0.247s
FAIL
[root@hpe-apollo-cn99xx-15-vm-27 ~]# 

The same test using valgrind passes on x86_64.

Below is the list of suites and testcases failing with with valgrind:

* both aarch64 and s390x
crypto/des (all tests)
crypto/ed25519/internal/edwards25519 (all tests)
crypto/ed25519/internal/edwards25519/field: TestAliasing TestMultiplyDistributesOverAdd
crypto/internal/subtle (all tests)
crypto/rc4 (all tests)
crypto/subtle (all tests)
crypto/x509: TestImports

* s390x only
crypto/dsa: TestParameterGeneration TestSignAndVerifyWithBadPublicKey
crypto/ecdsa: TestEqual
crypto/elliptic: TestInfinity TestMarshal TestMarshalCompressed
crypto/rsa: TestPSSSigning
crypto/x509: TestPKCS8 TestParseECPrivateKey
crypto/tls (all TestBoring*)

Version-Release number of selected component (if applicable):
RHEL-9.0.0-20220313.2
golang-1.17.7-1.el9_0
valgrind-3.18.1-9.el9

Steps to Reproduce:
1. OPENSSL_FORCE_FIPS_MODE=1 GOLANG_FIPS=1 go test -count=1 -v -v -v <suite> -run <testcase> -exec valgrind