Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 898640 - dev-lang/go build hangs with FEATURES=usersandbox
Summary: dev-lang/go build hangs with FEATURES=usersandbox
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Sandbox (show other bugs)
Hardware: riscv Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-01 20:52 UTC by matoro
Modified: 2024-02-15 15:40 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matoro archtester 2023-03-01 20:52:57 UTC
On riscv, trying to emerge any version of dev-lang/go with PORTAGE_SCHEDULING_POLICY=idle set in make.conf results in an infinite hang on "Building Go toolchain1".  Does not affect other architectures.

This affects all versions of go.  Tested bootstrapping from dev-lang/go-1.19.4, dev-lang/go-bootstrap-1.19.1.  Tested target versions dev-lang/go-1.19.5, dev-lang/go-1.20.1.

* Package:    dev-lang/go-1.20.1:0/1.20.1
 * Repository: gentoo
 * Maintainer: williamh@gentoo.org
 * USE:        elibc_glibc kernel_linux riscv userland_GNU
 * FEATURES:   compressdebug network-sandbox preserve-libs sandbox splitdebug userpriv usersandbox
>>> Unpacking source...
>>> Unpacking go1.20.1.src.tar.gz to /var/tmp/portage/dev-lang/go-1.20.1/work
>>> Source unpacked in /var/tmp/portage/dev-lang/go-1.20.1/work
>>> Preparing source in /var/tmp/portage/dev-lang/go-1.20.1/work/go ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-lang/go-1.20.1/work/go ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-lang/go-1.20.1/work/go ...
+ bootgo=1.17.13
+ set -e
+ '[' '!' -f run.bash ']'
+ '[' '' '!=' '' ']'
+ case "$(uname)" in
++ uname
+ ld --version
+ grep 'gold.* 2\.20'
+ for se_mount in /selinux /sys/fs/selinux
+ '[' -d /selinux -a -f /selinux/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ']'
+ for se_mount in /selinux /sys/fs/selinux
+ '[' -d /sys/fs/selinux -a -f /sys/fs/selinux/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ']'
++ uname -s
+ '[' Linux = GNU/kFreeBSD ']'
+ rm -f ./runtime/runtime_defs.go
+ verbose=false
+ vflag=
+ '[' '' = -v ']'
+ goroot_bootstrap_set=true
+ '[' -z /usr/lib/go ']'
+ export GOROOT_BOOTSTRAP
++ cd ..
++ pwd
+ export GOROOT=/var/tmp/portage/dev-lang/go-1.20.1/work/go
+ GOROOT=/var/tmp/portage/dev-lang/go-1.20.1/work/go
+ IFS='
'
++ type -ap go
+ for go_exe in $(type -ap go)
+ '[' '!' -x /usr/lib/go/bin/go ']'
+ unset IFS
+ '[' '!' -x /usr/lib/go/bin/go ']'
++ GOOS=
++ GOARCH=
++ GOEXPERIMENT=
++ /usr/lib/go/bin/go version
++ sed 's/go version //'
+ GOROOT_BOOTSTRAP_VERSION='go1.20.1 linux/riscv64'
+ echo 'Building Go cmd/dist using /usr/lib/go. (go1.20.1 linux/riscv64)'
Building Go cmd/dist using /usr/lib/go. (go1.20.1 linux/riscv64)
+ false
+ '[' /usr/lib/go = /var/tmp/portage/dev-lang/go-1.20.1/work/go ']'
+ rm -f cmd/dist/dist
+ GOROOT=/usr/lib/go
+ GOOS=
+ GOARCH=
+ GO111MODULE=off
+ GOEXPERIMENT=
+ GOENV=off
+ GOFLAGS=
+ /usr/lib/go/bin/go build -o cmd/dist/dist ./cmd/dist
++ ./cmd/dist/dist env -p
+ eval 'GO111MODULE=""' 'GOARCH="riscv64"' 'GOBIN="/var/tmp/portage/dev-lang/go-1.20.1/work/go/bin"' 'GOCACHE="/var/tmp/portage/dev-lang/go-1.20.1/work/go/pkg/obj/go-build"' 'GODEBUG=""' 'GOENV="off"' 'GOFLAGS=""' 'GOHOSTARCH="riscv64"' 'GOHOSTOS="linux"' 'GOOS="linux"' 'GOPROXY=""' 'GOROOT="/var/tmp/portage/dev-lang/go-1.20.1/work/go"' 'GOTMPDIR=""' 'GOTOOLDIR="/var/tmp/portage/dev-lang/go-1.20.1/work/go/pkg/tool/linux_riscv64"' 'GOWORK="off"' 'PATH="/var/tmp/portage/dev-lang/go-1.20.1/work/go/bin:/usr/lib/portage/python3.10/ebuild-helpers/xattr:/usr/lib/portage/python3.10/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"'
++ GO111MODULE=
++ GOARCH=riscv64
++ GOBIN=/var/tmp/portage/dev-lang/go-1.20.1/work/go/bin
++ GOCACHE=/var/tmp/portage/dev-lang/go-1.20.1/work/go/pkg/obj/go-build
++ GODEBUG=
++ GOENV=off
++ GOFLAGS=
++ GOHOSTARCH=riscv64
++ GOHOSTOS=linux
++ GOOS=linux
++ GOPROXY=
++ GOROOT=/var/tmp/portage/dev-lang/go-1.20.1/work/go
++ GOTMPDIR=
++ GOTOOLDIR=/var/tmp/portage/dev-lang/go-1.20.1/work/go/pkg/tool/linux_riscv64
++ GOWORK=off
++ PATH=/var/tmp/portage/dev-lang/go-1.20.1/work/go/bin:/usr/lib/portage/python3.10/ebuild-helpers/xattr:/usr/lib/portage/python3.10/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
+ '[' '' = true ']'
+ false
+ '[' '' = --dist-tool ']'
+ ./cmd/dist/dist bootstrap -a
Building Go toolchain1 using /usr/lib/go.
<hangs indefinitely here>

Reproducible: Always




Portage 3.0.45.1 (python 3.10.10-final-0, default/linux/riscv/20.0/rv64gc/lp64d, gcc-12, glibc-2.36-r7, 6.2.1-gentoo-riscv64 riscv64)
=================================================================
System uname: Linux-6.2.1-gentoo-riscv64-riscv64-with-glibc2.36
KiB Mem:    16390560 total,  10305588 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 28 Feb 2023 17:17:01 +0000
Head commit of repository gentoo: 8a31ae02c1ad12764c714ee4bb2a02b2c71b7edd

sh bash 5.2_p15-r2
ld GNU ld (Gentoo 2.39 p5) 2.39.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r2::gentoo
dev-lang/perl:             5.36.0-r2::gentoo
dev-lang/python:           3.10.10_p2::gentoo, 3.11.2_p1::gentoo
dev-lang/rust:             1.66.0::gentoo
dev-lang/rust-bin:         1.67.1::gentoo
dev-util/cmake:            3.25.2::gentoo
dev-util/meson:            1.0.0::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/openrc:           0.46::gentoo
sys-apps/sandbox:          2.30-r1::gentoo
sys-devel/autoconf:        2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r4::gentoo, 2.40-r2::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             12.2.1_p20230121-r1::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/make:            4.4.1::gentoo
sys-kernel/linux-headers:  6.2::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    sync-user: portage:portage
    priority: -1000
    volatile: False
    sync-git-verify-commit-signature: yes

guru
    location: /var/lib/layman/guru
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/repo/proj/guru.git
    masters: gentoo
    priority: 50
    volatile: True

ACCEPT_KEYWORDS="riscv ~riscv"
ACCEPT_LICENSE="@FREE"
CBUILD="riscv64-unknown-linux-gnu"
CFLAGS="-O3 -pipe -march=rv64imafdc -mcpu=sifive-u74 -mtune=sifive-7-series"
CHOST="riscv64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -pipe -march=rv64imafdc -mcpu=sifive-u74 -mtune=sifive-7-series"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--usepkg --autounmask=n --complete-graph --keep-going --with-bdeps=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe -march=rv64gc -mabi=lp64d"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live compress-build-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict network-sandbox news parallel-install preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=rv64gc -mabi=lp64d"
GENTOO_MIRRORS="https://gentoo.osuosl.org/ https://mirror.leaseweb.com/gentoo/ https://mirror.rackspace.com/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j3 -l2.45"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl bash-completion bzip2 caps cli crypt dri elogind fortran gdbm gentoo-vm graphite headless-awt iconv ipv6 libbsd libglvnd lm-sensors lto ncurses nls nptl openmp pam pcre pgo readline riscv seccomp split-usr ssl symlink system-bootstrap test-rust threads udev unicode verify-sig vhosts vim-syntax xattr zlib" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby31" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 matoro archtester 2023-03-27 16:43:22 UTC
I'm updating the title here because despite unsetting PORTAGE_SCHEDULING_POLICY=idle globally, I ran into this issue again with dev-lang/go-1.20.2.  After working through everything in FEATURES, I identified that it requires FEATURES=-usersandbox.  This works correctly even when PORTAGE_SCHEDULING_POLICY=idle is set.  Have no idea what's going on with this - maybe kernel changes?
Comment 2 nxjoseph 2023-04-23 21:47:58 UTC
I'm using amd64 and yes, it does hang on "Building Go toolchain1 using /usr/lib/go-bootstrap"
Comment 3 nxjoseph 2023-04-23 21:51:13 UTC
It was hanged at "/usr/lib/go-bootstrap/bin/go build -o cmd/dist/dist ./cmd/dist" but I was be able to pass it by removing and installing go-bootstrap package. now it hangs on bulding toolchain.
Comment 4 nxjoseph 2023-04-24 19:02:09 UTC
I tried emerging go with FEATURES=-usersandbox and it built succesfully.
Comment 5 Serge Broslavsky 2023-05-11 05:12:52 UTC
I have exactly the same problem on my x86_64 freshly installed system (Linux minion 6.1.19-gentoo-x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 10 14:59:39 MSK 2023 x86_64 AMD Ryzen 9 5900HX with Radeon Graphics AuthenticAMD GNU/Linux).

Same approach of fixing ("-usersandbox") also helps.
Although in my case it's dev-lang/go-1.20.3.

Got this problem with the initial installation using both versions of dev-lang/go-boostrap (1.18.6 and ~amd64 1.19.1), have the same problem with the installed go's toolchain afterwards.

Thus it's not just riscv, but at least also x86_64.
Comment 6 Errelin 2023-06-19 12:14:07 UTC
I would like to report the very same problem on ~amd64.

Actually in last April, I first experienced this problem. Yet due to my lack of experience and no compilation output (I turned them off), I have no idea what was wrong. Go is being compiled on my machine with a strange cpu load (~1.27, while I gave 12) and from output of htop, only a single core was working.

In the following versions of go, this problem appeared from time to time but since I see no one reported it (I once skimmed through bugs of dev-lang/go), I assumed it was my problem perhaps. Even now none of the gentoo users around me has ever experienced this problem. 

For now, I used `FEATURES=-usersandbox emerge -av1 dev-lang/go` to build it, as suggested in comment 4 above.

I'd like to add any further information if needed. Thank you :)
Comment 7 nxjoseph 2023-09-08 07:07:59 UTC
This issue seems solved with new go version 1.21.1 amd64. I updated the package without any tinkering.
Comment 8 Holger Hoffstätte 2024-02-15 15:39:54 UTC
See also: https://bugs.gentoo.org/912072

Not fixed with 1.22. Definitely sandbox- and/or runtime-initialisation related.