Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 664048

Summary: dev-lang/go with USE="gccgo" results in infinite hanging
Product: Gentoo Linux Reporter: aion1223
Component: Current packagesAssignee: William Hubbs <williamh>
Status: RESOLVED FIXED    
Severity: normal CC: andrius, dharding, dragan.kasler, esigra, gentoo, jasmin+gentoo, jesse, jstein, kentnl, luke-jr+gentoobugs, marien.zwart, ne3dle, sam
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 667610    
Attachments: build.log
ps -auxwww | grep portage
emerge --info
emerge --info
ps auxwww | grep portage output
dev-lang/go-1.12.1 build.log
output from emerge --info

Description aion1223 2018-08-19 10:47:25 UTC
Tested only on amd64 as it is the only one I have now. 

Emerging dev-lang/go1-10.{2,3}::gentoo package does not end when gccgo is included in the USE flags. By removing the "gccgo," and emerging the same package seems working fine. Here are the outputs from emerge -v go, at the end of which emerge hangs:
# emerge -v go

 * IMPORTANT: 25 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/go-1.10.3:0/1.10.3::gentoo  USE="gccgo*" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

!!! The following installed packages are masked:
- sys-devel/binutils-2.28.1::gentoo (masked by: package.mask)
/usr/portage/profiles/package.mask:
# Michał Górny <mgorny@gentoo.org>, Andreas K. Hüttel <dilfridge@gentoo.org>,
# Matthias Maier <tamiko@gentoo.org> (21 May 2017)
# These old versions of toolchain packages (binutils, gcc, glibc) are no
# longer officially supported and are not suitable for general use. Using
# these packages can result in build failures (and possible breakage) for
# many packages, and may leave your system vulnerable to known security
# exploits.
# If you still use one of these old toolchain packages, please upgrade (and
# switch the compiler / the binutils) ASAP. If you need them for a specific
# (isolated) use case, feel free to unmask them on your system.
# (updated 27 Dec 2017 with gcc < 5.4)

For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.



>>> Verifying ebuild manifests
>>> Running pre-merge checks for dev-lang/go-1.10.3

>>> Emerging (1 of 1) dev-lang/go-1.10.3::gentoo
 * go1.10.3.src.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                          [ ok ]
>>> Unpacking source...
>>> Unpacking go1.10.3.src.tar.gz to /var/tmp/portage/dev-lang/go-1.10.3/work
>>> Source unpacked in /var/tmp/portage/dev-lang/go-1.10.3/work
>>> Preparing source in /var/tmp/portage/dev-lang/go-1.10.3/work/go ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-lang/go-1.10.3/work/go ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-lang/go-1.10.3/work/go ...
 * GOROOT_BOOTSTRAP is /var/tmp/portage/dev-lang/go-1.10.3/work/go-linux-amd64-bootstrap
Building Go cmd/dist using /var/tmp/portage/dev-lang/go-1.10.3/work/go-linux-amd64-bootstrap.
Building Go toolchain1 using /var/tmp/portage/dev-lang/go-1.10.3/work/go-linux-amd64-bootstrap.


Perhaps, this might be upstream gccgo's bug. However, I do not know what exactly "emerge -v go" with gccgo enabled does. That's why I am filing this bug here first. 

Here are about gcc installed, which seems gcc-8.2.0-r2:

# gcc --version
gcc (Gentoo 8.2.0-r2 p1.2) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# emerge -vp gcc

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   *] sys-devel/gcc-8.2.0-r2:8.2.0::gentoo  USE="cxx debug fortran go (multilib) nls nptl openmp pch pgo (pie) sanitize ssp vtv (-altivec) -doc (-fixed-point) -graphite (-hardened) (-jit) (-libssp) -mpx -objc -objc++ -objc-gc -regression-test -systemtap -vanilla" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Here are the output of emerge --info:
# emerge --info
Portage 2.3.47 (python 3.6.6-final-0, default/linux/amd64/17.0/systemd, gcc-8.2.0, glibc-2.27-r6, 4.18.2-gentoo x86_64)
=================================================================
System uname: Linux-4.18.2-gentoo-x86_64-AMD_Ryzen_5_1500X_Quad-Core_Processor-with-gentoo-2.6
KiB Mem:    16424800 total,    629240 free
KiB Swap:   17415164 total,  17414908 free
Timestamp of repository gentoo: Sat, 18 Aug 2018 11:30:01 +0000
Head commit of repository gentoo: 5f7bad96f408e06d6f6e2eac6785e9a479ccbb3e
sh bash 4.4_p23
ld GNU ld (Gentoo 2.31.1 p1) 2.31.1
app-shells/bash:          4.4_p23::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.6::gentoo
dev-util/cmake:           3.12.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.28.1::gentoo, 2.31.1::gentoo
sys-devel/gcc:            5.4.0-r4::gentoo, 8.2.0-r2::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.17::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r6::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

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

eclipse
    location: /var/lib/layman/eclipse
    sync-type: laymansync
    sync-uri: https://github.com/gentoo/eclipse-overlay.git
    masters: gentoo
    priority: 50

mozilla
    location: /var/lib/layman/mozilla
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/mozilla.git
    masters: gentoo
    priority: 50

stuff
    location: /var/lib/layman/stuff
    sync-type: laymansync
    sync-uri: https://github.com/istitov/stuff.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=znver1 -mtune=znver1"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=znver1 -mtune=znver1"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_US ko"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
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"
USE="R X a52 acc acl acpi alsa amd64 anthy apache apache2 apng avx avx2 berkdb bzip2 c++ cairo cdpau cdr cjk clang cleartype cli corefonts crypt cups cxx dbus detex device-mapper dhcp dirac divx dri dvd dvdr dvdread dvi2tty emacs encode epspdf extras ffmpeg flac fortran fuse gdbm gdu gif gimp glitz gnome gnome-keyring gnome-online-accounts gold gtk gtk3 hal iconv icu imap introspection ipod ipv6 irc java jingle jpeg jpeg2k lame latex libffi libtirpc libwww linguas_en linguas_ja linguas_ko linlinguas_en_US m17n-lib maildir mikmod mmx modules mp2 mp3 mp3g2 mp4 mp4live mpeg mplayer multilib multitarget ncurses networkmanager nls nptl nsplugin ogg ogm opengl openmp pam pcre pdfannotextractor pluginwrapper png podcast policykit ppds pstricks publishers pulseaudio python readline real samba science scim sdl seccomp sftp sid snmp sound sqlite sse sse2 sse3 sse4 sse4_1 sse4_2 ssh ssl ssse3 subversion svg syslog systemd tcpd tex4ht texi2html theora threads tiff tracker truetype type1 udev unicode usb vaapi vcd vnc vorbis win32codecs wma wmf wmp x264 x265 xattr xcb xetex xine xml xvid youtube zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic auth_digest authn_alias authn_anon authn_core authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias http2 slotmem_shm xml2enc proxy proxy_balancer proxy_connect proxy_fcgi proxy_ftp proxy_html proxy_http" CALLIGRA_FEATURES="karbon plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="mouse keyboard evdev synaptic virtualbox" KERNEL="linux" L10N="ja ko en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU BPF NVPTX X86 AArch64 ARM Hexagon MSP430 Mips PowerPC Sparc SystemZ XCore" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="x86_64 aarch64 arm" QEMU_USER_TARGETS="aarch64 arm armeb x86_64" RUBY_TARGETS="ruby23 ruby25" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Dragan Kašler 2018-08-22 11:18:59 UTC
Created attachment 544440 [details]
build.log
Comment 2 Dragan Kašler 2018-08-22 11:19:29 UTC
Created attachment 544442 [details]
ps -auxwww | grep portage
Comment 3 Dragan Kašler 2018-08-22 11:19:56 UTC
Created attachment 544444 [details]
emerge --info
Comment 4 Marien Zwart 2018-08-22 12:21:05 UTC
I ran into what's probably the same thing (tried multiple versions of dev-lang/go, using sys-devel/gcc-8.2.0-r2). It's a gccgo + sandbox (I'm using sys-apps/sandbox-2.13) + parallel compile bug.

This hangs (with usersandbox in FEATURES):

$ ebuild /usr/portage/dev-lang/go/go-1.10.3.ebuild compile

This doesn't:

$ FEATURES="-sandbox -usersandbox" ebuild /usr/portage/dev-lang/go/go-1.10.3.ebuild compile

Process tree typically has one or more "go install" processes. From a hang with only one leaf process:

marienz  31456 31245  0 21:22 pts/6    00:00:00           [dev-lang/go-1.10.3] sandbox /usr/lib/portage/python3.6/ebuild.sh compile
marienz  31457 31456  0 21:22 pts/6    00:00:00             /bin/bash /usr/lib/portage/python3.6/ebuild.sh compile
marienz  31474 31457  0 21:22 pts/6    00:00:00               /bin/bash /usr/lib/portage/python3.6/ebuild.sh compile
marienz  31524 31474  0 21:22 pts/6    00:00:00                 bash ./make.bash
marienz  31607 31524  2 21:22 pts/6    00:00:00                   ./cmd/dist/dist bootstrap -a
marienz  31621 31607  3 21:22 pts/6    00:00:00                     /var/tmp/portage/dev-lang/go-1.10.3/work/go-linux-amd64-bootstrap/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap bootstrap/cmd/...
marienz  31631 31621  0 21:22 pts/6    00:00:00                       /var/tmp/portage/dev-lang/go-1.10.3/work/go-linux-amd64-bootstrap/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap bootstrap/cmd/...

Stack from the leaf process (31631):

#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007ff8dced9054 in __GI___pthread_mutex_lock (mutex=0x7ff8deaca360 <lock>) at ../nptl/pthread_mutex_lock.c:78
#2  0x00007ff8deab2704 in before_syscall (dirfd=<optimized out>, sb_nr=53, func=0x7ff8deabde0c "execve", file=0xc420220090 "/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0/gccgo", flags=0)
    at /var/tmp/portage/sys-apps/sandbox-2.13/work/sandbox-2.13/libsandbox/libsandbox.c:1035
#3  0x00007ff8deab2f82 in before_syscall (dirfd=dirfd@entry=-100, sb_nr=sb_nr@entry=53, func=func@entry=0x7ff8deabde0c "execve", file=file@entry=0xc420220090 "/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0/gccgo", flags=flags@entry=0)
    at /var/tmp/portage/sys-apps/sandbox-2.13/work/sandbox-2.13/libsandbox/libsandbox.c:1013
#4  0x00007ff8deab782c in execve_DEFAULT (path=path@entry=0xc420220090 "/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0/gccgo", argv=argv@entry=0xc4201f6200, envp=envp@entry=0xc420117600)
    at /var/tmp/portage/sys-apps/sandbox-2.13/work/sandbox-2.13/libsandbox/wrapper-funcs/__wrapper_exec.c:304
#5  0x00007ff8de1ce7e8 in syscall.raw_execve (envv=0xc420117600, argv=0xc4201f6200, argv0=0xc420220090 "/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0/gccgo") at libcalls.go:253
#6  syscall.forkAndExecInChild1 (argv0=argv0@entry=0xc420220090 "/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0/gccgo", chroot=0x0, dir=0x0, attr=0x7ff8b1558ac0, sys=0x7ff8deaa8840 <syscall.zeroSysProcAttr>, pipe=24, argv=..., envv=...)
    at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/syscall/exec_linux.go:412
#7  0x00007ff8de1cef35 in syscall.forkAndExecInChild (pipe=<optimized out>, sys=<optimized out>, attr=0x7ff8b1558ac0, dir=0x0, chroot=0x0, argv0=0xc420220090 "/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0/gccgo", argv=..., envv=...)
    at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/syscall/exec_linux.go:80
#8  syscall.forkExec (argv0=..., argv=..., attr=0x7ff8b1558ac0) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/syscall/exec_unix.go:245
#9  0x00007ff8de1cf711 in syscall.StartProcess (argv0=..., argv=..., attr=attr@entry=0x7ff8b1558ac0) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/syscall/exec_unix.go:292
#10 0x00007ff8de0cfcbe in os.startProcess (attr=<optimized out>, argv=..., name=...) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/os/exec_posix.go:46
#11 os.StartProcess (name=..., argv=..., attr=attr@entry=0x7ff8b1558ef0) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/os/exec.go:102
#12 0x00007ff8de0da1b1 in os_exec.Cmd.Start (param=param@entry=0xc42049e000) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/os/exec/exec.go:379
#13 0x00007ff8de0da8e4 in os_exec.Cmd.Run (c=<optimized out>) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/os/exec/exec.go:302
#14 0x00007ff8de0daa02 in os_exec.Cmd.CombinedOutput (c=c@entry=0xc42049e000) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/os/exec/exec.go:521
#15 0x000056094188d9bd in cmd_go_internal_work.Builder.gccgoToolID (b=b@entry=0xc4201697c0, name=..., language=...) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/cmd/go/internal/work/buildid.go:240
#16 0x00005609418ad115 in cmd_go_internal_work.Builder.buildActionID (b=b@entry=0xc4201697c0, a=<optimized out>) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/cmd/go/internal/work/exec.go:257
#17 0x00005609418bc616 in cmd_go_internal_work.Builder.build (b=<optimized out>, a=<optimized out>) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/cmd/go/internal/work/exec.go:304
#18 0x00005609418c1d44 in work.cmd_go_internal_work..thunk0 ($this=<optimized out>, a=<optimized out>) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/cmd/go/internal/work/action.go:339
#19 0x000056094188eec1 in work.func1 (a=<optimized out>) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/cmd/go/internal/work/exec.go:106
#20 0x000056094188e6e1 in work.func2 () at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/cmd/go/internal/work/exec.go:164
#21 0x0000560941882d77 in work.cmd_go_internal_work..thunk9 (__go_thunk_parameter=<optimized out>) at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/cmd/go/internal/work/exec.go:151
#22 0x00007ff8de15fde9 in runtime.kickoff () at /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/runtime/proc.go:1167
#23 0x00007ff8dcf60ca0 in ?? () from /lib64/libc.so.6
#24 0x0000000000000000 in ?? ()

There's only one thread. So we're deadlocked here (/var/tmp/portage/sys-apps/sandbox-2.13/work/sandbox-2.13/libsandbox/libsandbox.c):

	/* Need to protect the global sbcontext structure */
	sb_lock();

in a child process after fork, before exec. That probably means we forked while another thread held that lock. That's supposed to be protected against by sandbox wrapping fork() (/var/tmp/portage/sys-apps/sandbox-2.13/work/sandbox-2.13/libsandbox/wrapper-funcs/fork.c):

/* We're only wrapping fork() as a poor man's pthread_atfork().  That would
 * require dedicated linkage against libpthread.  So here we force the locks
 * to a consistent state before forking. #263657
 */

but gccgo forked by calling syscall(__NR_clone, ...) directly (via forkAndExecInChild1 in /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/syscall/exec_linux.go, which calls rawClone() in /var/tmp/portage/sys-devel/gcc-8.2.0-r2/work/gcc-8.2.0/libgo/go/syscall/clone_linux.c, which calls syscall() on everything but SPARC).

When gccgo then execve()s, it does so using (exec_linux.go again):

	err1 = raw_execve(argv0, &argv[0], &envv[0])

and raw_execve is (exec_unix.go):

//sysnb raw_execve(argv0 *byte, argv **byte, envv **byte) (err Errno)
//execve(argv0 *byte, argv **byte, envv **byte) _C_int

which means "call the execve() C function" (see mksyscall.awk).

So although it missed the fork, sandbox can catch the execve() just fine, and we deadlock if we forked while sandbox was dealing with a different call.

I suspect this doesn't happen when using Go to bootstrap because it uses a direct syscall for execve too. In dev-lang/go-1.10.3, execve is (exec_linux.go):

	_, _, err1 = RawSyscall(SYS_EXECVE,
		uintptr(unsafe.Pointer(argv0)),
		uintptr(unsafe.Pointer(&argv[0])),
		uintptr(unsafe.Pointer(&envv[0])))

which doesn't hit the execve() C function. I assume we don't end up back in sandbox code after fork before exec, so we have no opportunity to deadlock.

I could be way off on why it works without gccgo: I can interpret a stack trace when sandbox is broken, but I don't understand it all that well when it works :)

I don't know how to fix this (short of disabling sandbox, which might not be completely unreasonable if it's mostly bypassed without gccgo, but I didn't confirm that's actually true!).
Comment 5 Andrius Štikonas 2018-10-14 15:18:36 UTC
Seems to be the same issue as #618794
Comment 6 Marien Zwart 2018-10-15 08:43:10 UTC
The backtraces in bug #618794 don't look like the ones here. That other bug mentions segfaults, and the one backtrace that doesn't involve a segfault (bug #618794 comment #4) is in the Go runtime, not sandbox. It also mentions "Two threads are used 100%", while this one is a deadlock (no cpu usage).
 
If that other bug is the same as this one, "ebuild /path/to/go.ebuild compile" as non-root without usersandbox should succeed.
Comment 7 Jesse Adelman 2019-04-03 17:19:24 UTC
Just confirming same effect here, amd64 stable (mostly), with dev-lang/go-1.12.1, and gccgo USE flag set.
Comment 8 elprawn 2019-04-03 21:03:51 UTC
I get the same issue, but when I build with MAKEOPTS="-j1", I see a little more output -

>>> Building Go cmd/dist using /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap.
>>> Building Go toolchain1 using /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap.
>>> # bootstrap/math/bits
>>> /var/tmp/portage/dev-lang/go-1.12.1/work/go/src/math/bits/bits.go:534:3: error: divideError is not a function; //go:linkname is only supported for functions
>>>  //go:linkname divideError runtime.divideError
>>>    ^
>>> /var/tmp/portage/dev-lang/go-1.12.1/work/go/src/math/bits/bits.go:531:3: error: overflowError is not a function; //go:linkname is only supported for functions
>>>  //go:linkname overflowError runtime.overflowError
>>>    ^

Which is the issue described here - https://github.com/golang/go/issues/30771

Other than that the symptoms are the same. It happens at the same point and as before, the CPU usage drops to 0 and it hangs indefinitely.
Comment 9 elprawn 2019-04-03 21:14:13 UTC
(In reply to elprawn from comment #8)
> I get the same issue, but when I build with MAKEOPTS="-j1", I see a little
> more output -
> 
> >>> Building Go cmd/dist using /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap.
> >>> Building Go toolchain1 using /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap.
> >>> # bootstrap/math/bits
> >>> /var/tmp/portage/dev-lang/go-1.12.1/work/go/src/math/bits/bits.go:534:3: error: divideError is not a function; //go:linkname is only supported for functions
> >>>  //go:linkname divideError runtime.divideError
> >>>    ^
> >>> /var/tmp/portage/dev-lang/go-1.12.1/work/go/src/math/bits/bits.go:531:3: error: overflowError is not a function; //go:linkname is only supported for functions
> >>>  //go:linkname overflowError runtime.overflowError
> >>>    ^
> 
> Which is the issue described here - https://github.com/golang/go/issues/30771
> 
> Other than that the symptoms are the same. It happens at the same point and
> as before, the CPU usage drops to 0 and it hangs indefinitely.

Sorry, forgot to add, here is the output from emerge --info

Portage 2.3.62 (python 3.6.5-final-0, default/linux/amd64/17.0/desktop/plasma, gcc-8.2.0, glibc-2.28-r5, 4.19.27-gentoo-r1 x86_64)
=================================================================
System uname: Linux-4.19.27-gentoo-r1-x86_64-Intel-R-_Core-TM-_i3-3217U_CPU_@_1.80GHz-with-gentoo-2.6
KiB Mem:     5908748 total,    638680 free
KiB Swap:   12582908 total,  12569516 free
Timestamp of repository gentoo: Tue, 02 Apr 2019 19:24:25 +0000
Head commit of repository gentoo: 5ade04cfbbd568f5231c368daa164505dde8f78c

sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.30 p5) 2.30.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.14.1-r2::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.30-r4::gentoo
sys-devel/gcc:            8.2.0-r6::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.14-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.28-r5::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    priority: -1000

farmboy0
    location: /var/lib/layman/farmboy0
    masters: gentoo
    priority: 50

haskell
    location: /var/lib/layman/haskell
    masters: gentoo
    priority: 50

hossie
    location: /var/lib/layman/hossie
    masters: gentoo
    priority: 50

jollheef-overlay
    location: /var/lib/layman/jollheef-overlay
    masters: gentoo
    priority: 50

jorgicio
    location: /var/lib/layman/jorgicio
    masters: gentoo
    priority: 50

junkdrawer
    location: /var/lib/layman/junkdrawer
    masters: gentoo
    priority: 50

programmador
    location: /var/lib/layman/programmador
    masters: gentoo
    priority: 50

qt
    location: /var/lib/layman/qt
    masters: gentoo
    priority: 50

zugaina
    location: /var/lib/layman/zugaina
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.2/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://anongit.gentoo.org/git/repo/sync/gentoo.git rsync://mirror.bytemark.co.uk/gentoo/ http://mirror.bytemark.co.uk/gentoo/ ftp://mirror.bytemark.co.uk/gentoo/ http://mirror.qubenet.net/mirror/gentoo/ http://www.mirrorservice.org/sites/distfiles.gentoo.org/ rsync://rsync.mirrorservice.org/distfiles.gentoo.org/ ftp://ftp.mirrorservice.org/sites/distfiles.gentoo.org/"
LANG="en_GB.ISO-8859-1"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB en en-GB"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
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"
USE="X a52 aac acl acpi activities alsa amd64 berkdb bidi bluetooth branding bzip2 cairo cdda cdio cdr cli consolekit crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam ffmpeg flac fortran freetype gbm gd gdbm gif glamor gnutls gpm gtk httpd iconv icu ipv6 jpeg kde kipi kwallet lcms ldap libkms libnotify libtirpc live lua mad matroska mmx mng mp3 mp4 mpeg multilib ncurses nls nptl ogg oggvorbis opengl openmp pam pango pcre pdf phonon pipelight plasma png policykit ppds pulseaudio qml qt5 readline sdl seccomp semantic-desktop spell sse sse2 ssl startup-notification stream svg tcpd theora tiff truetype udev udisks unicode upower usb vcd vlm vorbis webkit widgets wxwidgets wxwindows x264 xa xattr xcb xcomposite xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" L10N="en_GB en en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby23" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS




As you can see, I'm using gcc 8.2 and the failure was when rebuilding go when running a world update (so not new package or upgrade). The last time I built it, it was with MAKEOPTS="-j5". I suspect it may have been before I upgraded gcc,since the gccgo flag shows as new on the rebuild.
Comment 10 needle 2019-04-04 08:01:49 UTC
The build of gcc-1.12.1 results in hanging as well. CPU is normal but the process of building go hangs:

---

 ps aux | grep lang/go
root      7498  0.0  0.1  83040 14736 ?        SN   03:18   0:00 /usr/bin/python3.6m /usr/lib/portage/python3.6/lock-helper.py /var/tmp/portage/dev-lang/go-1.12.1
pbogusze 11134  0.0  0.0  14276   924 pts/3    S+   09:55   0:00 grep --color=auto lang/go
root     16900  0.0  0.1  41148 10140 pts/1    SNs+ 03:12   0:00 /usr/bin/python3.6m /usr/lib/portage/python3.6/pid-ns-init 250 250 250 18 0,1,2 /usr/bin/sandbox [dev-lang/go-1.12.1] sandbox /usr/lib/portage/python3.6/ebuild.sh compile
portage  16903  0.0  0.0   4400  1772 pts/1    SN+  03:12   0:00 [dev-lang/go-1.12.1] sandbox /usr/lib/portage/python3.6/ebuild.sh compile
portage  17057  0.0  0.6 944744 49220 pts/1    SNl+ 03:12   0:04 /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap bootstrap/cmd/...
portage  17067  0.0  0.2 600368 21092 pts/1    SN+  03:12   0:00 /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap bootstrap/cmd/...
portage  17118  0.0  0.2 928344 22312 pts/1    SN+  03:12   0:00 /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap bootstrap/cmd/...

---
This is what the build.log over here says

 * Package:    dev-lang/go-1.12.1
 * Repository: gentoo
 * Maintainer: williamh@gentoo.org
 * USE:        abi_x86_64 amd64 elibc_glibc gccgo kernel_linux userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking go1.12.1.src.tar.gz to /var/tmp/portage/dev-lang/go-1.12.1/work
>>> Source unpacked in /var/tmp/portage/dev-lang/go-1.12.1/work
>>> Preparing source in /var/tmp/portage/dev-lang/go-1.12.1/work/go ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-lang/go-1.12.1/work/go ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-lang/go-1.12.1/work/go ...
Building Go cmd/dist using /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap.
Building Go toolchain1 using /var/tmp/portage/dev-lang/go-1.12.1/work/go-linux-amd64-bootstrap.
# bootstrap/math/bits
/var/tmp/portage/dev-lang/go-1.12.1/work/go/src/math/bits/bits.go:534:3: error: divideError is not a function; //go:linkname is only supported for functions
 //go:linkname divideError runtime.divideError
   ^
/var/tmp/portage/dev-lang/go-1.12.1/work/go/src/math/bits/bits.go:531:3: error: overflowError is not a function; //go:linkname is only supported for functions
 //go:linkname overflowError runtime.overflowError

---

#emerge --info
Portage 2.3.62 (python 3.6.5-final-0, default/linux/amd64/17.0, gcc-8.2.0, glibc-2.28-r5, 4.14.105-gentoo-r1 x86_64)
=================================================================
System uname: Linux-4.14.105-gentoo-r1-x86_64-Intel-R-_Core-TM-_i5-4278U_CPU_@_2.60GHz-with-gentoo-2.6
KiB Mem:     8128120 total,   3013524 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository gentoo: Thu, 04 Apr 2019 00:45:01 +0000
Head commit of repository gentoo: 9d190af4dfb4101ea252a2fdcb6630af851390a2
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.30 p5) 2.30.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.30-r4::gentoo
sys-devel/gcc:            8.2.0-r6::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.14-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.28-r5::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.de.gentoo.org/gentoo-portage/
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: no
    sync-rsync-extra-opts: 

needless
    location: /usr/local/portage
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/angband/gamedata/ /etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg candy collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync metadata-transfer multilib-strict network-sandbox news nodoc parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
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"
USE="7zip X aac acpi alsa amd64 apm asm bash-completion berkdb bonobo bzip2 cairo cddb cjk cli cpudetection cracklib crypt cue cups curl custom-flags cxx dga diskio dri drm egl encode expat faad fbcon flac fontforge fortran fuse gallium gdbm gif glamor gpm gtk gtk2 gtkstyle hscolour iconv imagemagick ipv6 jpeg jpeg2k lame laptop libcaca libclamav libgda libmms libnotify libsamplerate libsndfile libtirpc lm_sensors logrotate lua lzo mad mbox modpack mp3 mpeg mplayer multilib musepack museplug ncurses noamazon nptl ogg oggvorbis opengl openmp openssl pam pango pcre pdf png qemu qt5 readline savedconfig schroedinger screen seccomp sensord sox sql sqlite sqlite3 ssl svg tcpd tga threads tiff truetype unicode vaapi vim-syntax vorbis wavpack wifi xattr xcomposite xft xml xorg zip zlib zsh-completion" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="synaptics evdev" KERNEL="linux" L10N="de en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 11 needle 2019-04-04 08:04:50 UTC
Created attachment 571794 [details]
emerge --info
Comment 12 needle 2019-04-04 08:05:18 UTC
Created attachment 571796 [details]
ps auxwww | grep portage output
Comment 13 needle 2019-04-04 08:06:36 UTC
Created attachment 571798 [details]
dev-lang/go-1.12.1 build.log
Comment 14 Andrius Štikonas 2019-04-06 12:00:10 UTC
(In reply to needle from comment #13)
> Created attachment 571798 [details]
> dev-lang/go-1.12.1 build.log

That's unrelated issue and is fixed upstream.
Comment 15 Andrius Štikonas 2019-04-06 12:01:32 UTC
(In reply to Andrius Štikonas from comment #14)
> (In reply to needle from comment #13)
> > Created attachment 571798 [details]
> > dev-lang/go-1.12.1 build.log
> 
> That's unrelated issue and is fixed upstream.

https://github.com/golang/go/issues/30771
Comment 16 Amit Prakash Ambasta 2019-09-30 06:22:47 UTC
Something is going on w/ the ebuild here. Doesn't seem like an upstream bug since I can manually bootstrap and build with gccgo or with portage if I set GOMAXPROCS=1 i.e. GOMAXPROCS=1 emerge -av go
Comment 17 tt_1 2020-01-24 18:44:10 UTC
Created attachment 604206 [details]
output from emerge --info

same here with newest dev-lang/go-1.13.6: 

 * Package:    dev-lang/go-1.13.6
 * Repository: gentoo
 * Maintainer: williamh@gentoo.org
 * USE:        abi_x86_64 amd64 elibc_glibc gccgo kernel_linux userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking go1.13.6.src.tar.gz to /var/tmp/portage/dev-lang/go-1.13.6/work
>>> Source unpacked in /var/tmp/portage/dev-lang/go-1.13.6/work
>>> Preparing source in /var/tmp/portage/dev-lang/go-1.13.6/work/go ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-lang/go-1.13.6/work/go ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-lang/go-1.13.6/work/go ...
Building Go cmd/dist using /var/tmp/portage/dev-lang/go-1.13.6/work/go-linux-amd64-bootstrap.
Building Go toolchain1 using /var/tmp/portage/dev-lang/go-1.13.6/work/go-linux-amd64-bootstrap.
sandbox:stop  caught signal 2 in pid 4
sandbox:stop  Send signal 4 more times to force SIGKILL


it works without the gccgo useflag enabled, so it's only mildly annoying that I rebuilt gcc with the go useflag beforehand and having wasted the cpu cycles.
Comment 18 Luke-Jr 2020-01-24 19:40:24 UTC
(In reply to tt_1 from comment #17)
> it works without the gccgo useflag enabled, so it's only mildly annoying
> that I rebuilt gcc with the go useflag beforehand and having wasted the cpu
> cycles.

Without the gccgo USE flag, it's downloading and executing third-party binaries. There's a risk of a recursive backdoor that way.
Comment 19 William Hubbs gentoo-dev 2020-02-02 20:43:31 UTC
The use of the gccgo use flag was dropped in go 1.13.

Yes, you are correct that we now use third party binaries to build Go if
go was not previously installed.

The third party binaries are created by me, and are a static go
toolchain. They are only used to compile this toolchain if there is not
a previous go installed.

For more info see the upstream documentation on installing go from
source [1].

[1] https://golang.org/doc/install/source
Comment 20 Luke-Jr 2020-02-02 20:58:52 UTC
That's a major regression, since we now need to trust binaries built by you.