Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silent compilation failure and SYSCALL miss in kernel version 5.4.x and golang-1.20.4 #60064

Closed
Chairou opened this issue May 9, 2023 · 3 comments
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@Chairou
Copy link

Chairou commented May 9, 2023

Background:
Under Linux kernel version 5.4.x, there is a silent compilation failure, and no error is reported in the log. After investigation and retry, it was found that under the combination of kenel 5.4.X+golang 1.20.4+our backend system code, there will be silent errors and system call errors. This issue can be reliably reproduced.

OS Env:
Linux 907cd202b23f 5.4.119-1-tlinux4-0010.2(base on 5.4.X) #1 SMP Fri Nov 4 17:13:35 CST 2022 x86_64 x86_64 x86_64 GNU/Linux

go env:
[root@907cd202b23f ~/go/src/odp-admin-backend]# go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="git.code.oa.com,github.com,xorm.io,launchpad.net,git.woa.com"
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://goproxy.woa.com,direct"
GOROOT="/opt/go"
GOSUMDB="sum.woa.com+643d7a06+Ac5f5VOC4N8NUXdmhbm8pZSXIWfhek5JSmWdWrq7pLX4"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/root/go/src/odp-admin-backend/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1301571221=/tmp/go-build -gno-record-gcc-switches"

Compilation command:
export GIT_TERMINAL_PROMPT=1
export GOPROXY="https://goproxy.woa.com,direct"
export GOSUMDB="sum.woa.com+643d7a06+Ac5f5VOC4N8NUXdmhbm8pZSXIWfhek5JSmWdWrq7pLX4"
export GOINSECURE=git.code.oa.com,github.com,xorm.io,launchpad.net,git.woa.com
export GOPRIVATE=""
#go clean --modcache

go mod tidy -compat=1.20
go mod vendor
yum install -y gpgme-devel
yum install -y device-mapper-devel.x86_64
yum install -y libassuan-devel.x86_64
yum install -y btrfs-progs-devel
CGO_ENABLED=1 GOARCH=amd64 GOOS=linux CGO_CFLAGS="" CGO_LDFLAGS="-L/usr/lib64 -lgpgme" go build -v -o bin/main cmd/server/main.go

Error situation :
On the first execution of the above compilation command, there was a silent error and the compilation exited without any error logs, which caused complete confusion about the situation. It was initially thought that there was a problem with the CI/CD system. The screenshot is as follows:
image

Then, when directly executing the command "CGO_ENABLED=1 GOARCH=amd64 GOOS=linux CGO_CFLAGS="" CGO_LDFLAGS="-L/usr/lib64 -lgpgme" go build -v -o bin/main cmd/server/main.go" for recompilation, an error was finally reported.
image

error message is
github.com/containers/storage/pkg/unshare
unshare.c: In function 'copy_self_proc_exe':
unshare.c:236:17: error: 'SYS_memfd_create' undeclared (first use in this function)
mmfd = syscall(SYS_memfd_create, exename, (long) MFD_ALLOW_SEALING | MFD_CLOEXEC);
^
unshare.c:236:17: note: each undeclared identifier is reported only once for each function it appears in

Probable cause:
The kernel 5.4.x may have reduced the SYS_memfd_create system call, which caused the compilation to fail. However, the first silent error may be due to a bug.

Thanks for your help :)

@Chairou
Copy link
Author

Chairou commented May 9, 2023

it seens on these files
./pkg/mod/github.com/containers/storage@v1.37.1-0.20211119174841-bf170b3ddac0/pkg/unshare/unshare.c
./pkg/mod/modernc.org/libc@v1.14.1/musl/src/linux/unshare.c
./src/odp-admin-backend/vendor/github.com/containers/storage/pkg/unshare/unshare.c
./src/odp-admin-backend/third_party/containers/common/vendor/github.com/containers/storage/pkg/unshare/unshare.c

@seankhliao
Copy link
Member

how do we reproduce this?
and please don't use screenshots, the ones you've posted are impossible to read

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 9, 2023
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants