Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909416 - sys-apps/sandbox fails tests on arm64
Summary: sys-apps/sandbox fails tests on arm64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal (vote)
Assignee: Sandbox Maintainers
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-06-30 19:19 UTC by matoro
Modified: 2023-07-08 03:16 UTC (History)
3 users (show)

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


Attachments
build.log (build.log,207.02 KB, text/plain)
2023-06-30 19:21 UTC, matoro
Details
testsuite.log (testsuite.log,240.85 KB, text/plain)
2023-06-30 19:21 UTC, matoro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matoro archtester 2023-06-30 19:19:38 UTC
Does NOT repro on amd64, does NOT repro on ppc64le.  DOES repro on both 2.29 and 2.32.  DOES repro on both zfs and ext4 filesystems.

## ------------------------ ##
## sandbox 2.29 test suite. ##
## ------------------------ ##

  1: access/1                                        ok
 10: futimesat/3                                     ok
  9: futimesat/2                                     ok
  4: execv/1                                         ok
  8: futimesat/1                                     ok
  6: fchownat/1                                      ok
  3: chown/1                                         ok
  2: chmod/1                                         ok
  7: fchownat/2                                      ok
  5: fchmodat/1                                      ok
 12: link/1                                          ok
 13: linkat/1                                        ok
 14: linkat/2                                        ok
 11: lchown/1                                        ok
 20: mkdir/2                                         ok
 15: linkat_static/1                                 ok
 17: malloc/1                                        ok
 18: malloc/2                                        ok
 16: linkat_static/2                                 ok
 19: mkdir/1                                         ok
 23: mkdirat/1                                       ok
 24: mkdirat/2                                       ok
 22: mkdir_static/1                                  ok
 25: mkdirat/3                                       ok
 27: mkfifo/1                                        ok
 28: mkfifoat/1                                      ok
 29: mknod/1                                         ok
 26: mkdtemp/1                                       ok
 21: mkdir/3                                         ok
 30: mknodat/1                                       ok
 31: mkostemp/1                                      ok
 33: mkostemps/1                                     ok
 32: mkostemp64/1                                    ok
 34: mkostemps64/1                                   ok
 36: mkstemp64/1                                     ok
 35: mkstemp/1                                       ok
 39: open/1                                          ok
 37: mkstemps/1                                      ok
 38: mkstemps64/1                                    ok
 40: open/2                                          ok
 42: openat/1                                        ok
 43: openat/2                                        ok
 47: remove/1                                        ok
 41: open_static/1                                   ok
 49: rename/1                                        ok
 44: openat_static/1                                 ok
 45: openat_static/2                                 ok
 46: opendir/1                                       ok
 48: removexattr/1                                   ok
 50: renameat/1                                      ok
 58: sb_printf                                       ok
 51: renameat/2                                      ok
 53: renameat2/1                                     ok
 52: renameat/3                                      ok
 55: renameat2/3                                     ok
 54: renameat2/2                                     ok
 56: rmdir/1                                         ok
 59: script/1                                        ok
 57: rmdir/2                                         ok
 60: script/2                                        ok
 64: script/6                                        ok
 61: script/3                                        ok
 65: script/7                                        ok
 66: script/8                                        ok
 67: script/9                                        ok
 69: script/11                                       ok
 62: script/4                                        ok
 70: script/12                                       ok
 72: script/14                                       ok
 74: script/16                                       ok
 77: symlink/1                                       ok
 75: setxattr/1                                      ok
 73: script/15                                       ok
 68: script/10                                       ok
 76: signal_static/1                                 ok
 78: symlinkat/1                                     ok
 79: symlinkat/2                                     ok
 80: symlinkat/3                                     ok
 81: unlink/1                                        ok
 83: unlinkat/1                                      ok
 84: unlinkat/2                                      ok
 82: unlink_static/1                                 FAILED (unlink_static.at:1)
 86: unlinkat/4                                      ok
 85: unlinkat/3                                      ok
 87: utimensat/1                                     ok
 88: utimensat/2                                     ok
 89: utimensat/3                                     ok
 91: utimensat64/1                                   ok
 92: utimensat64_static/1                            ok
 93: utimensat_static/1                              ok
 94: utimensat_static/2                              ok
 90: utimensat/4                                     ok
 95: vfork/1                                         ok
 71: script/13                                       ok
 63: script/5                                        ok
 
## ------------- ##
## Test results. ##
## ------------- ##
 
ERROR: All 95 tests were run,
1 failed unexpectedly.

## ------------------------ ##
## Summary of the failures. ##
## ------------------------ ##
Failed tests:
sandbox 2.29 test suite test groups:
 
 NUM: FILE-NAME:LINE     TEST-GROUP-NAME
      KEYWORDS
 
  82: unlink_static.at:1 unlink_static/1
      unlink_static static
 
## ---------------------- ##
## Detailed failed tests. ##
## ---------------------- ##
 
#                             -*- compilation -*-
82. unlink_static.at:1: testing unlink_static/1 ...
/var/tmp/portage/sys-apps/sandbox-2.29/work/sandbox-2.29/tests/unlink_static.at:1: \
        env \
                SANDBOX_LOG="$PWD/sandbox.log" \
                sandbox.sh -c \
                        addpredict / \; \
                        addwrite "${PWD%/*}" \; \
                        set -x \; \
 . $abs_top_srcdir/tests/unlink_static-1.sh
stderr:
 * --------------------------------------------------------------------------------
th as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line
 
F: UNLINKAT
S: deny
P: f
A: /var/tmp/portage/sys-apps/sandbox-2.29/work/sandbox-2.29-.arm64/tests/testsuite.dir/82/f
R: /var/tmp/portage/sys-apps/sandbox-2.29/work/sandbox-2.29-.arm64/tests/testsuite.dir/82/f
C: unlink_static-0 -1,EPERM f 
tic-0 -1,EPERM f
++ test -e sandbox.log -a -e f
stdout:
PASS: unlink("f") = -1 (wanted -1); errno = EPERM:1 [Operation not permitted] (wanted EPERM:1 [Operation not permitted])
/var/tmp/portage/sys-apps/sandbox-2.29/work/sandbox-2.29/tests/unlink_static.at:1: exit code was 1, expected 0
82. unlink_static.at:1: 82. unlink_static/1 (unlink_static.at:1): FAILED (unlink_static.at:1)

Reproducible: Always




Portage 3.0.46 (python 3.11.4-final-0, default/linux/arm64/17.0, gcc-12, glibc-2.36-r8, 6.1.33-gentoo-dist aarch64)
=================================================================
System uname: Linux-6.1.33-gentoo-dist-aarch64-with-glibc2.36
KiB Mem:    65138760 total,  18863068 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Fri, 30 Jun 2023 00:45:01 +0000
Head commit of repository gentoo: 0844f8e13bf04922de15e1d5a79de326f80dc63f
sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.39 p6) 2.39.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-lang/perl:             5.36.1-r2::gentoo
dev-lang/python:           3.11.4::gentoo
dev-util/meson:            1.1.1::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/openrc:           0.46::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r6::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             12.2.1_p20230428-r1::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r8::gentoo
Repositories:

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

ACCEPT_KEYWORDS="arm64"
ACCEPT_LICENSE="@FREE"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="aarch64-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/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=y --autounmask-continue=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"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps 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"
LEX="flex"
MAKEOPTS="-j10"
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="/sbin/nologin"
USE="acl arm64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libtirpc ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl test-rust unicode 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" CPU_FLAGS_ARM="edsp v8 vfp vfp-d32 vfpv3 vfpv4" 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="php8-1" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="fbdev dummy v4l" 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-06-30 19:21:35 UTC
Created attachment 864894 [details]
build.log
Comment 2 matoro archtester 2023-06-30 19:21:52 UTC
Created attachment 864895 [details]
testsuite.log
Comment 3 Mike Gilbert gentoo-dev 2023-07-05 17:59:15 UTC
I can reproduce this with sandbox-2.34 on an arm64 EC2 server.
Comment 4 Mike Gilbert gentoo-dev 2023-07-05 21:45:17 UTC
This is a really weird bug. The ptrace code in sandbox is definitely catching the unlinkat syscall, but the kernel still removes the file.

arm64 seems to be unique in that the kernel provides unlinkat(), but does not provide unlink(). libc provides unlink() as a library function that calls unlinkat(). I'm not sure if this is related to the problem.

Anyway, I suspect there is something wrong with the sandbox code that modifies the system call. Either that, or we have run into a kernel bug.
Comment 5 Mike Gilbert gentoo-dev 2023-07-06 19:40:28 UTC
Apparently this test has never worked on arm64.

https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=3e60745c278248baa9cac3da0b4ed3f7dcd96501

We should probably XFAIL it for now.
Comment 6 Larry the Git Cow gentoo-dev 2023-07-08 03:06:52 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=f4c6bf434459d2d7b57c003e4eab81f2f8c21f51

commit f4c6bf434459d2d7b57c003e4eab81f2f8c21f51
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-07-08 02:50:02 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-07-08 03:05:11 +0000

    libsandbox/trace: fix syscall cancellation on arm64
    
    arm64 has a dedicated regset to manipulate the system call number.
    See kernel commit 766a85d7bc5d7f1ddd6de28bdb844eae45ec63b0.
    
    Bug: https://bugs.gentoo.org/909416
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 libsandbox/trace/linux/aarch64.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
Comment 7 Larry the Git Cow gentoo-dev 2023-07-08 03:16:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2aa847a538da66fbfccc7b5866fa0adf3e21b982

commit 2aa847a538da66fbfccc7b5866fa0adf3e21b982
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-07-08 03:11:37 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-07-08 03:11:37 +0000

    sys-apps/sandbox: add 2.35
    
    Closes: https://bugs.gentoo.org/909416
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-apps/sandbox/Manifest            |  1 +
 sys-apps/sandbox/sandbox-2.35.ebuild | 64 ++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)