Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 908765 - >=sys-apps/sandbox-2.30-r1 on musl with <linux-5.8 - sandbox:main could not open the sandbox rc file: /usr/share/sandbox/sandbox.bashrc: Invalid argument
Summary: >=sys-apps/sandbox-2.30-r1 on musl with <linux-5.8 - sandbox:main could not ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Sandbox Maintainers
URL:
Whiteboard:
Keywords:
: 908766 (view as bug list)
Depends on:
Blocks: 908565
  Show dependency tree
 
Reported: 2023-06-18 12:11 UTC by tt_1
Modified: 2023-06-21 14:55 UTC (History)
2 users (show)

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


Attachments
output from emerge --info (emerge-info,6.14 KB, text/plain)
2023-06-18 12:20 UTC, tt_1
Details
output of strace -f sandbox uptime (strace,8.44 KB, text/plain)
2023-06-18 18:29 UTC, tt_1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2023-06-18 12:11:43 UTC
when upgrading from sandbox-2.29 to new stable sandbox-2.30-r1 on armv7a-musl, the new sandbox instance is fundamentally broken: 

sandbox:main  could not open the sandbox rc file: /usr/share/sandbox/sandbox.bashrc: Invalid argument

followd by this: 

 * The ebuild phase 'unpack' has exited unexpectedly. This type of behavior
 * is known to be triggered by things such as failed variable assignments
 * (bug #190128) or bad substitution errors (bug #200313). Normally, before
 * exiting, bash should have displayed an error message above. If bash did
 * not produce an error message above, it's possible that the ebuild has
 * called `exit` when it should have called `die` instead. This behavior
 * may also be triggered by a corrupt bash binary or a hardware problem
 * such as memory or cpu malfunction. If the problem is not reproducible or
 * it appears to occur randomly, then it is likely to be triggered by a
 * hardware problem. If you suspect a hardware problem then you should try
 * some basic hardware diagnostics such as memtest. Please do not report
 * this as a bug unless it is consistently reproducible and you are sure
 * that your bash binary and hardware are functioning properly.

this is all it does when trying to emerge just any package

please mask on all musl profiles
Comment 1 tt_1 2023-06-18 12:20:04 UTC
Created attachment 864141 [details]
output from emerge --info

also all tests are failing
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-18 15:05:21 UTC
I can't reproduce this on amd64 + musl. I'll check it on arm now.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-18 17:58:31 UTC
(In reply to Sam James from comment #2)
> I can't reproduce this on amd64 + musl. I'll check it on arm now.

Can't reproduce.

Please include the full 'strace -f' output of a failing command (full emerge if necessary, but try e.g. 'strace -f sandbox uptime' first).
Comment 4 tt_1 2023-06-18 18:29:35 UTC
Created attachment 864160 [details]
output of strace -f sandbox uptime

something is missing: 

faccessat2(AT_FDCWD, "/var/log/sandbox/sandbox-23890.log", F_OK, AT_SYMLINK_NOFOLLOW) = -1 ENOSYS (Function not implemented)

check libsandbox/pre_check_openat.c, it was added there with sandbox-2.30: 

https://gitweb.gentoo.org/proj/sandbox.git/tree/libsandbox/pre_check_openat.c#n22
Comment 5 Mike Gilbert gentoo-dev 2023-06-18 18:38:14 UTC
faccessat2 was added in Linux 5.8.

You appear to be running Linux 4.19.x.
Comment 6 Mike Gilbert gentoo-dev 2023-06-18 18:41:39 UTC
The issue was probably introduced here:

https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=f63fea69097e37424c700f820d25591747a15752
Comment 7 Mike Gilbert gentoo-dev 2023-06-18 18:43:12 UTC
*** Bug 908766 has been marked as a duplicate of this bug. ***
Comment 8 Mike Gilbert gentoo-dev 2023-06-18 18:58:19 UTC
The behavior on musl seems to be different from glibc.

On glibc, if faccessat2 fails with ENOSYS, it calls fstatat (or newfstatat on amd64) as a fallback.

> faccessat2(AT_FDCWD, "/dev/null", F_OK, AT_SYMLINK_NOFOLLOW) = -1 ENOSYS (Function not implemented)
> newfstatat(AT_FDCWD, "/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(0x1, 0x3), ...}, AT_SYMLINK_NOFOLLOW) = 0
Comment 9 Mike Gilbert gentoo-dev 2023-06-19 20:12:42 UTC
musl bug report: https://www.openwall.com/lists/musl/2023/06/19/1
Comment 10 Larry the Git Cow gentoo-dev 2023-06-21 14:41:20 UTC
The bug has been referenced in the following commit(s):

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

commit b55840ebe3278032777a3b52cecc6dac325dcf85
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-06-19 15:50:46 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-06-21 14:40:08 +0000

    libsbutil: add sb_exists function
    
    This provides a central place to work around a bug on musl where
    faccessat sets errno to EINVAL when the kernel does not support
    faccessat2.
    
    Bug: https://bugs.gentoo.org/908765
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 libsandbox/pre_check_openat.c              |  2 +-
 libsandbox/wrapper-funcs/fopen_pre_check.c |  2 +-
 libsbutil/local.mk                         |  1 +
 libsbutil/sb_exists.c                      | 24 ++++++++++++++++++++++++
 libsbutil/sbutil.h                         |  1 +
 libsbutil/src/file.c                       |  2 +-
 6 files changed, 29 insertions(+), 3 deletions(-)
Comment 11 Larry the Git Cow gentoo-dev 2023-06-21 14:55:20 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1581bf33d00a80115a4f78bcb292faccc962a700

commit 1581bf33d00a80115a4f78bcb292faccc962a700
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-06-21 14:54:13 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-06-21 14:55:16 +0000

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

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