>>> Test phase: app-arch/zstd-1.4.5 * abi_x86_64.amd64: running multilib-minimal_abi_src_test make -j1 check make -C tests shortest make[1]: Entering directory '/var/tmp/portage/app-arch/zstd-1.4.5/work/zstd-1.4.5-abi_x86_64.amd64/tests' cc -I../lib -I../lib/common -I../lib/compress -I../lib/dictBuilder -I../lib/deprecated -I../programs -march=native -mtune=native -O2 -pipe -pthread -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings -Wredundant-decls -Wmissing-prototypes -g -DDEBUGLEVEL=1 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu ../programs/datagen.c datagencli.c -o datagen make -C ../programs zstd MOREFLAGS+="-g -DDEBUGLEVEL=1" make[2]: Entering directory '/var/tmp/portage/app-arch/zstd-1.4.5/work/zstd-1.4.5-abi_x86_64.amd64/programs' make[2]: 'zstd' is up to date. make[2]: Leaving directory '/var/tmp/portage/app-arch/zstd-1.4.5/work/zstd-1.4.5-abi_x86_64.amd64/programs' file ../programs/zstd make[1]: *** [Makefile:326: test-zstd] Bad system call make[1]: Leaving directory '/var/tmp/portage/app-arch/zstd-1.4.5/work/zstd-1.4.5-abi_x86_64.amd64/tests' make: *** [Makefile:87: shortest] Error 2 * ERROR: app-arch/zstd-1.4.5::gentoo failed (test phase): * Make check failed. See above for details. * * Call stack: * ebuild.sh, line 125: Called src_test * environment, line 2025: Called multilib-minimal_src_test * environment, line 1369: Called multilib_foreach_abi 'multilib-minimal_abi_src_test' * environment, line 1560: Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_test' * environment, line 1234: Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_test' * environment, line 1232: Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_test' * environment, line 401: Called multilib-minimal_abi_src_test * environment, line 1365: Called default_src_test * phase-functions.sh, line 884: Called __eapi0_src_test * phase-helpers.sh, line 779: Called die * The specific snippet of code: * $emake_cmd ${internal_opts} check || \ * die "Make check failed. See above for details." * * If you need support, post the output of `emerge --info '=app-arch/zstd-1.4.5::gentoo'`, * the complete build log and the output of `emerge -pqv '=app-arch/zstd-1.4.5::gentoo'`. * The complete build log is located at '/var/tmp/portage/app-arch/zstd-1.4.5/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/app-arch/zstd-1.4.5/temp/environment'. * Working directory: '/var/tmp/portage/app-arch/zstd-1.4.5/work/zstd-1.4.5-abi_x86_64.amd64' * S: '/var/tmp/portage/app-arch/zstd-1.4.5/work/zstd-1.4.5' From dmesg: [177048.900648] audit: type=1326 audit(1592729539.626:9): auid=1000 uid=250 gid=250 ses=1 pid=6637 comm="file" exe="/usr/bin/file" sig=31 arch=c000003e syscall=79 compat=0 ip=0x7f7b6e7d150a code=0x0 Reproducible: Always
Created attachment 645486 [details] build.log # emerge -pqv '=app-arch/zstd-1.4.5::gentoo' '=sys-apps/file-5.39::gentoo' [ebuild R ] sys-apps/file-5.39 USE="bzip2 lzma seccomp zlib -python -static-libs" PYTHON_TARGETS="python3_7 -python3_6 -python3_8 -python3_9" [ebuild R ] app-arch/zstd-1.4.5 USE="threads -lz4 -static-libs" # emerge --info '=app-arch/zstd-1.4.5::gentoo' Portage 2.3.101 (python 3.7.7-final-0, default/linux/amd64/17.1/no-multilib/hardened, gcc-10.1.0, glibc-2.31-r5, 5.7.4 x86_64) ================================================================= System Settings ================================================================= System uname: Linux-5.7.4-x86_64-Intel-R-_Core-TM-_i7-4810MQ_CPU_@_2.80GHz-with-gentoo-2.7 KiB Mem: 16356564 total, 5199996 free KiB Swap: 20971516 total, 20971516 free Timestamp of repository gentoo: Sun, 21 Jun 2020 08:30:01 +0000 Head commit of repository gentoo: 2674d8d5720f7e45851a8323a2a33dfb37a7eb1d sh bash 5.0_p17 ld GNU ld (Gentoo 2.34 p4) 2.34.0 app-shells/bash: 5.0_p17::gentoo dev-java/java-config: 2.3::gentoo dev-lang/perl: 5.30.3-r1::gentoo dev-lang/python: 2.7.18::gentoo, 3.7.7-r2::gentoo, 3.8.3::gentoo, 3.9.0_beta3::gentoo dev-util/cmake: 3.17.3::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.7::gentoo sys-apps/openrc: 0.42.1::gentoo sys-apps/sandbox: 2.20::gentoo sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r5::gentoo sys-devel/automake: 1.16.2::gentoo sys-devel/binutils: 2.34-r1::gentoo sys-devel/gcc: 10.1.0-r1::gentoo sys-devel/gcc-config: 2.3::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.7::gentoo (virtual/os-headers) sys-libs/glibc: 2.31-r5::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-verify-jobs: 1 sync-rsync-verify-metamanifest: yes sync-rsync-verify-max-age: 24 sync-rsync-extra-opts: --new-compress local location: /var/lib/portage-local/local masters: gentoo priority: 0 testing location: /var/lib/portage-local/testing masters: gentoo priority: 1 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -mtune=native -O2 -pipe" 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="-march=native -mtune=native -O2 -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y" ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY 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" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu" LINGUAS="" MAKEOPTS="-j8" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_EXTRA_OPTS="--new-compress" 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 acl acpi alsa amd64 avx bzip2 cairo caps cdda cddb cdparanoia crypt cups dbus dri dts dvd elogind fam ffmpeg fftw flac fontconfig gif gimp gmp gnutls gtk hardened iconv icu idn ipv6 jpeg lame lcms libnotify libtirpc lzma mad matroska mmap mmx mmxext mp3 mpeg ncurses networkmanager nptl ogg opengl openmp pam pcre pie png policykit ppds readline sasl sdl seccomp split-usr sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svg test theora threads tiff truetype udev udisks unicode upower vaapi vorbis wayland x264 xattr xcb xinerama xml xtpax xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" 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 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" 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" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="i965 intel nouveau" 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, LANG, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS ================================================================= Package Settings ================================================================= app-arch/zstd-1.4.5::gentoo was built with the following: USE="threads -lz4 -static-libs" CFLAGS="-march=native -mtune=native -O2 -pipe -pthread" CXXFLAGS="-march=native -mtune=native -O2 -pipe -pthread"
file's seccomp sandbox does not work under portage's sandbox. The test suite can runs without error if file is invoked with parameter -S to disable system-call sandboxing. This can be done by adding sed -i 's/file $(/file -S $(/' tests/Makefile to src_prepare() in the ebuild.
*** Bug 728888 has been marked as a duplicate of this bug. ***
(In reply to tka from comment #2) > file's seccomp sandbox does not work under portage's sandbox. The test suite > can runs without error if file is invoked with parameter -S to disable > system-call sandboxing. This can be done by adding > > sed -i 's/file $(/file -S $(/' tests/Makefile > > to src_prepare() in the ebuild. I was hoping it wouldn't happen. I would say the best option is to just patch file to disable seccomp when the sandbox environment variable is present. That way, we still have a win most of the time.
Which syscall is failing? If it is something innocuous, we might be able to get a patch merged upstream for file.
(In reply to Mike Gilbert from comment #5) > Which syscall is failing? If it is something innocuous, we might be able to > get a patch merged upstream for file. The failing syscall is getcwd. /tmp $ echo asdf > a # does not fail with an empty file /tmp $ sandbox ============================= Gentoo path sandbox ============================== Detection of the support files. Verification of the required files. Setting up the required environment variables. The protected environment has been started. -------------------------------------------------------------------------------- Process being started in forked instance. /tmp $ strace file a [...snip...] lstat(0x7ffe06742e0b, 0x7ffe06741c10) = 0 stat(0x7ffe06742e0b, 0x7ffe0673fa70) = 0 mmap(NULL, 8208, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f40ba1b8000 getcwd( <unfinished ...>) = ? +++ killed by SIGSYS +++ Bad system call
Created attachment 645532 [details, diff] Patch for sys-apps/file to make its sandbox run in portage's sandbox This patch allows file to run in sandbox mode even in portage's sandbox. Adding getcwd to the list of allowed syscalls makes zstd's test suite pass. This patch also makes the current file-5.39-seccomp_sandbox.patch, which disables file's sandbox in its own test suite, obsolete.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e7234f3304d3a7471390c4699892d49d41028e2 commit 0e7234f3304d3a7471390c4699892d49d41028e2 Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2020-06-24 09:26:16 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2020-06-24 09:27:50 +0000 sys-apps/file: Attempt to fix seccomp in portage's sandbox Thanks-to: tka <tka@kamph.org> Bug: https://bugs.gentoo.org/728978 Package-Manager: Portage-2.3.102, Repoman-2.3.23 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> sys-apps/file/file-5.39-r1.ebuild | 140 +++++++++++++++++++++ .../file/files/file-5.39-portage_sandbox.patch | 28 +++++ 2 files changed, 168 insertions(+)
(In reply to tka from comment #7) > Created attachment 645532 [details, diff] [details, diff] > Patch for sys-apps/file to make its sandbox run in portage's sandbox > > This patch allows file to run in sandbox mode even in portage's sandbox. > Adding getcwd to the list of allowed syscalls makes zstd's test suite pass. > This patch also makes the current file-5.39-seccomp_sandbox.patch, which > disables file's sandbox in its own test suite, obsolete. This patch breaks the build of file-5.39 on musl i686 with seccomp. Currently: 1) file-5.39-seccomp_sandbox.patch for #713710 works for musl i686 but 2) file-5.39-portage_sandbox.patch breaks for musl i686. I currently have seccomp use masked on x86 for sys-apps/file but it would be nice to get this fixed there.
(In reply to Anthony Basile from comment #10) > (In reply to tka from comment #7) > > Created attachment 645532 [details, diff] [details, diff] [details, diff] > > Patch for sys-apps/file to make its sandbox run in portage's sandbox > > > > This patch allows file to run in sandbox mode even in portage's sandbox. > > Adding getcwd to the list of allowed syscalls makes zstd's test suite pass. > > This patch also makes the current file-5.39-seccomp_sandbox.patch, which > > disables file's sandbox in its own test suite, obsolete. > > This patch breaks the build of file-5.39 on musl i686 with seccomp. > Currently: > > 1) file-5.39-seccomp_sandbox.patch for #713710 works for musl i686 > > but > > 2) file-5.39-portage_sandbox.patch breaks for musl i686. > > I currently have seccomp use masked on x86 for sys-apps/file but it would be > nice to get this fixed there. 743 Making all in magic 744 make[2]: Entering directory '/var/tmp/portage/sys-apps/file-5.39-r2/work/file-5.39-abi_x86_32.x86/magic' 745 ../src/file -C -m magic 746 make[2]: *** [Makefile:833: magic.mgc] Bad system call 747 make[2]: Leaving directory '/var/tmp/portage/sys-apps/file-5.39-r2/work/file-5.39-abi_x86_32.x86/magic' 748 make[1]: *** [Makefile:458: all-recursive] Error 1 749 make[1]: Leaving directory '/var/tmp/portage/sys-apps/file-5.39-r2/work/file-5.39-abi_x86_32.x86' 750 make: *** [Makefile:367: all] Error 2 751 * ERROR: sys-apps/file-5.39-r2::gentoo failed (compile phase): 752 * emake failed
You will need to strace the file command to figure out what syscall is failing on musl,
statx perhaps? sf /var/tmp/portage/sys-apps/file-5.39-r2/work/file-5.39-abi_x86_32.x86/magic # ../src/file -C -m magic Bad system call sf /var/tmp/portage/sys-apps/file-5.39-r2/work/file-5.39-abi_x86_32.x86/magic # strace ../src/file -C -m magic |& tail -n 10 prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) = 0 prctl(PR_SET_DUMPABLE, SUID_DUMP_DISABLE) = 0 brk(NULL) = 0x57d38000 brk(0x57d39000) = 0x57d39000 brk(0x57d3a000) = 0x57d3a000 prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) = 0 seccomp(SECCOMP_SET_MODE_STRICT, 1, NULL) = -1 EINVAL (Invalid argument) seccomp(SECCOMP_SET_MODE_FILTER, 0, {len=47, filter=0x57d39c40}) = 0 statx(AT_FDCWD, "magic", AT_STATX_SYNC_AS_STAT, STATX_BASIC_STATS, <unfinished ...>) = ? +++ killed by SIGSYS +++
(In reply to Sergei Trofimovich from comment #13) > statx(AT_FDCWD, "magic", AT_STATX_SYNC_AS_STAT, STATX_BASIC_STATS, > <unfinished ...>) = ? > +++ killed by SIGSYS +++ Probably fixed in https://github.com/file/file/commit/93c91e2ba8042d499fee168e27cbd526438454c6. You might want to pull all the syscalls added since last release.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=728f8c43b8b540f37871be3080ac63c05a9cf6a7 commit 728f8c43b8b540f37871be3080ac63c05a9cf6a7 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2020-09-07 16:55:11 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2020-09-07 16:55:11 +0000 sys-apps/file: backport a seccomp fix for musl Closes: https://bugs.gentoo.org/728978 Signed-off-by: Mike Gilbert <floppym@gentoo.org> sys-apps/file/file-5.39-r1.ebuild | 140 --------------------- .../{file-5.39-r2.ebuild => file-5.39-r3.ebuild} | 5 +- sys-apps/file/file-5.39.ebuild | 140 --------------------- .../file/files/file-5.39-add-missing-termios.patch | 35 +++--- ...ndbox.patch => file-5.39-portage-sandbox.patch} | 18 ++- sys-apps/file/files/file-5.39-seccomp-musl.patch | 37 ++++++ .../file/files/file-5.39-seccomp_sandbox.patch | 13 -- 7 files changed, 67 insertions(+), 321 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dbbbf5f526aff28f9c8ba79c7a277bc3aa09398b commit dbbbf5f526aff28f9c8ba79c7a277bc3aa09398b Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2023-10-19 18:06:37 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2023-10-19 18:08:42 +0000 sys-apps/file: add another seccomp fix for sandbox Bug: https://bugs.gentoo.org/728978 Bug: https://bugs.gentoo.org/889046 Bug: https://bugs.gentoo.org/915890 Signed-off-by: Mike Gilbert <floppym@gentoo.org> .../{file-5.45-r1.ebuild => file-5.45-r2.ebuild} | 2 +- .../file/files/file-5.45-seccomp-sandbox.patch | 48 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-)