golang-fips / go

Repository for FIPS enabled Go using OpenSSL
BSD 3-Clause "New" or "Revised" License
64 stars 21 forks source link

go1.21-opensslv2-staging branch fails to dynamically link on ARM32 Arch #176

Open manistal opened 4 months ago

manistal commented 4 months ago

Build system used was Yocto with recipes from Poky:

Build Configuration:
BB_VERSION           = "1.36.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "ipq8074a"
DISTRO               = "poky"
DISTRO_VERSION       = "2.4.4"
TUNE_FEATURES        = "arm armv7a vfp thumb neon vfpv4 callconvention-hard"
TARGET_FPU           = "hard"

Host machine x86_64, with target architecture ARM32/v7 - go 1.21.8 builds successfully, however after applying the patches in go1.21-opensslv2-staging:

| HASH[linkShared]: "top vendor/golang.org/x/text/secure/bidirule=FpkbO78hQyBlBiTOORBH\n"
| HASH[linkShared]: "top vendor/golang.org/x/text/transform=hveFt4djHRTLqltF39uj\n"
| HASH[linkShared]: "top vendor/golang.org/x/text/unicode/bidi=ammQB407V4VM_Rz1NWJO\n"
| HASH[linkShared]: "top vendor/golang.org/x/text/unicode/norm=KXnoy-L8RjV-wgCEe6z6\n"
| HASH[linkShared]: b0813a3a6bf7d8b387fb2e2c0519f52353b3d0abecce4eebd43c6ec41ea70d2e
| # /home/jenkins/poky/build/tmp/work/armv7ahf-neon-vfpv4-poky-linux-gnueabi/go-runtime/1.21.8-r0/go-tmp/go-build460557780/b278/libstd.so
| panic: runtime error: invalid memory address or nil pointer dereference
| [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5125e6]
| 
| goroutine 1 [running]:
| cmd/link/internal/loader.(*Loader).SymSize(0x669ae0?, 0x68c120?)
|   cmd/link/internal/loader/loader.go:815 +0x46
| cmd/link/internal/ld.(*pclntab).generatePctab.func1(0x0)
|   cmd/link/internal/ld/pcln.go:453 +0x56
| cmd/link/internal/ld.(*pclntab).generatePctab(0xc000d4e080, 0xc000186000, {0xc001986000, 0x666b, 0x200?})
|   cmd/link/internal/ld/pcln.go:476 +0x39f
| cmd/link/internal/ld.(*Link).pclntab(0xc000186000, {0xc001366000?, 0xc000146420?, 0xf?})
|   cmd/link/internal/ld/pcln.go:779 +0x1ad
| cmd/link/internal/ld.Main(_, {0x4, 0x8, 0x1, 0xd, 0xe, 0x1c00000, {0x0, 0x0, 0x0}, ...})
|   cmd/link/internal/ld/main.go:349 +0x1590
| main.main()
|   cmd/link/main.go:72 +0xdfb
| WARNING: exit code 1 from a shell command.

Disabling dynamic linking in the build resolves this issue, but results in a larger go runtime.

Is this an issue that would eventually get fixed for Go 1.21 or would this be addressed in later releases? Thanks!

pmalhaire commented 1 month ago

I am facing the same issue with go 1.22.4 using poky too

pmalhaire commented 1 month ago

Same stack is in this issue https://github.com/golang/go/issues/67635

pmalhaire commented 1 month ago

The issue is inside golang a temporary solution is to use go1.23rc1 as go-native