Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 751241 - sys-apps/sandbox: missing 64-bit time_t coverage on 32-bit time_t systems (fails test utimensat_static/2)
Summary: sys-apps/sandbox: missing 64-bit time_t coverage on 32-bit time_t systems (fa...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sandbox Maintainers
URL:
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks: time32-bugs
  Show dependency tree
 
Reported: 2020-10-25 20:35 UTC by Thomas Deutschmann (RETIRED)
Modified: 2023-07-18 17:54 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,198.18 KB, text/plain)
2020-10-25 20:35 UTC, Thomas Deutschmann (RETIRED)
Details
build.log (2.20, ppc) (sandbox-2.20:20201210-224511.log,180.23 KB, text/plain)
2020-12-10 23:26 UTC, ernsteiswuerfel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann (RETIRED) gentoo-dev 2020-10-25 20:35:05 UTC
Created attachment 668552 [details]
build.log

> ## ------------------------ ##
> ## Summary of the failures. ##
> ## ------------------------ ##
> Failed tests:
> sandbox 2.20 test suite test groups:
> 
>  NUM: FILE-NAME:LINE     TEST-GROUP-NAME
>       KEYWORDS
> 
>   87: utimensat_static.at:2 utimensat_static/2
>       utimensat_static static
> 
> ## ---------------------- ##
> ## Detailed failed tests. ##
> ## ---------------------- ##
> 
> #                             -*- compilation -*-
> 87. utimensat_static.at:2: testing utimensat_static/2 ...
> /var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20/tests/utimensat_static.at:2: \
>         env \
>                 SANDBOX_LOG="$PWD/sandbox.log" \
>                 sandbox.sh \
>                         addpredict / \; \
>                         addwrite "${PWD%/*}" \; \
>                         set -x \; \
>  . $abs_top_srcdir/tests/utimensat_static-2.sh
> stderr:
> + . /var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20/tests/utimensat_static-2.sh
> ++ '[' no = yes ']'
> ++ adddeny /var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20-abi_x86_32.x86/tests/testsuite.dir/87
> ++ export SANDBOX_DENY=:/var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20-abi_x86_32.x86/tests/testsuite.dir/87
> ++ SANDBOX_DENY=:/var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20-abi_x86_32.x86/tests/testsuite.dir/87
> ++ utimensat_static-0 -1,EACCES AT_FDCWD . NULL 0
> ++ test -s sandbox.log
> stdout:
> FAIL: utimensat(-100, ".", (nil), 0) = 0 (wanted -1); errno = Success:0 [Success] (wanted EACCES:13 [Permission denied])
> /var/tmp/portage/sys-apps/sandbox-2.20/work/sandbox-2.20/tests/utimensat_static.at:2: exit code was 1, expected 0
> 87. utimensat_static.at:2: 87. utimensat_static/2 (utimensat_static.at:2): FAILED (utimensat_static.at:2)

No regression, at least 2.18 shows the same failure.



Portage 3.0.8 (python 3.7.9-final-0, default/linux/x86/17.0, gcc-9.3.0, glibc-2.31-r6, 5.4.72-gentoo-x86 i686)
=================================================================
System uname: Linux-5.4.72-gentoo-x86-i686-with-gentoo-2.7
KiB Mem:     3106076 total,    199080 free
KiB Swap:    8875836 total,   8856264 free
Timestamp of repository gentoo: Sun, 25 Oct 2020 13:05:31 +0000
Head commit of repository gentoo: 0040a4b7a79b32b59b1b0c791d4b17bf491fba71

sh bash 5.0_p18
ld GNU ld (Gentoo 2.34 p6) 2.34.0
app-shells/bash:          5.0_p18::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r4::gentoo, 3.6.12::gentoo, 3.7.9::gentoo, 3.8.5::gentoo
dev-util/cmake:           3.17.4-r1::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.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.34-r2::gentoo
sys-devel/gcc:            9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.2::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r6::gentoo
Repositories:

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

ABI="x86"
ABI_X86="32"
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="*"
ACCEPT_PROPERTIES="*"
ACCEPT_RESTRICT="*"
ADA_TARGET="gnat_2018"
ARCH="x86"
BINPKG_COMPRESS="bzip2"
BROOT=""
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=pentium4m -mtune=pentium4m -Wno-error=jump-misses-init -Wno-error=sign-compare"
CHOST="i686-pc-linux-gnu"
CHOST_x86="i686-pc-linux-gnu"
COLLISION_IGNORE="/lib/modules/*"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CPU_FLAGS_X86="mmx mmxext sse sse2"
CXXFLAGS="-O2 -pipe -march=pentium4m -mtune=pentium4m -Wno-error=jump-misses-init -Wno-error=sign-compare"
DEFAULT_ABI="x86"
EDITOR="/usr/bin/mcedit"
ELIBC="glibc"
ENV_UNSET="CARGO_HOME 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"
EPREFIX=""
EROOT="/"
ESYSROOT="/"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs cgroup config-protect-if-modified distlocks downgrade-backup 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 unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=i686 -pipe"
GCC_SPECS=""
GRUB_PLATFORMS="efi-32 pc"
GSETTINGS_BACKEND="dconf"
HOME="/root"
INFOPATH="/usr/share/gcc-data/i686-pc-linux-gnu/9.3.0/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.34/info:/usr/share/info"
INPUT_DEVICES="libinput"
IUSE_IMPLICIT="abi_x86_32 prefix prefix-guest prefix-stack"
KERNEL="linux"
L10N="en en-US de de-DE"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LC_MESSAGES="C"
LC_PAPER="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LIBDIR_x86="lib"
LINGUAS="en de"
LOGNAME="root"
LUA_SINGLE_TARGET="lua5-1"
LUA_TARGETS="lua5-1"
MAIL="/var/mail/root"
MAKEOPTS="--jobs 5 --load-average 7.95"
MANPAGER="manpager"
MOTD_SHOWN="pam"
MULTILIB_ABIS="x86"
NOCOLOR="true"
OFFICE_IMPLEMENTATION="libreoffice"
OPENCL_PROFILE="ocl-icd"
OPENGL_PROFILE="xorg-x11"
PAGER="/usr/bin/less"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/10/bin"
PHP_TARGETS="php7-2 php7-3"
POSTGRES_TARGETS="postgres10 postgres11"
PWD="/root"
PYTHONDONTWRITEBYTECODE="1"
PYTHON_SINGLE_TARGET="python3_7"
PYTHON_TARGETS="python2_7 python3_7"
QT_GRAPHICSSYSTEM="raster"
ROOT="/"
ROOTPATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/10/bin"
RUBY_TARGETS="ruby25 ruby26"
SHELL="/bin/bash"
SHLVL="2"
SSH_TTY="/dev/pts/0"
SYSROOT="/"
TERM="tmux-256color"
TMUX="/tmp//tmux-0/default,3586,0"
TMUX_PANE="%2"
TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
USER="root"
USERLAND="GNU"
VIDEO_CARDS="vmware"
XDG_CONFIG_DIRS="/etc/xdg"
XDG_DATA_DIRS="/usr/local/share:/usr/share"
XDG_RUNTIME_DIR="/run/user/0"
XDG_SESSION_CLASS="user"
XDG_SESSION_ID="3"
XDG_SESSION_TYPE="tty"
Comment 1 Rolf Eike Beer archtester 2020-10-29 07:18:27 UTC
Same on hppa.
Comment 2 ernsteiswuerfel archtester 2020-12-10 23:26:03 UTC
Created attachment 677803 [details]
build.log (2.20, ppc)

Same on ppc.
Comment 3 Rolf Eike Beer archtester 2021-04-24 19:36:52 UTC
Still in 2.21.
Comment 4 SpanKY gentoo-dev 2021-10-22 05:25:55 UTC
this shows up on most 32-bit systems today because they all use 32-bit time_t.  they've recently had 64-bit time_t glibc interfaces & syscalls added, and it's these new ones that we aren't checking for.

we have two issues here:
(1) we need to add C library wrappers for the new 64-bit time_t interfaces
(2) we need to have 64-bit time_t syscall coverage too

fixing (1) should be pretty easy ... just have to manually enumerate the new symbols glibc is exporting for 64-bit time_t.

unfortunately, fixing (2) is harder than it should be as it runs into a design limitation that i've been dreading a bit.  when i first bolted the ptrace layer on, it was with a couple of lazy assumptions:
- there is a 1-to-1 binding between the C library interface and the underlying syscall
- the C library interface & syscalls use the same names
in this case, glibc is using __utimensat64, but the syscall is utimensat_time64.

so i think i'm going to have to dig us out of that hole to get static stracing working.

if you're interested in the 32-bit time_t problem in general, check out:
https://en.wikipedia.org/wiki/Year_2038_problem
https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
Comment 5 Larry the Git Cow gentoo-dev 2021-10-23 22:19:46 UTC
The bug has been closed via the following commit(s):

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

commit a07dffb605956bd37a1a0ce0801b7d5233c2f67a
Author:     Mike Frysinger <vapier@gentoo.org>
AuthorDate: 2021-10-23 09:49:00 +0000
Commit:     Mike Frysinger <vapier@gentoo.org>
CommitDate: 2021-10-23 22:18:04 +0000

    libsandbox: extend symbols format to specify diff syscall name
    
    This enables support for 64-bit time_t syscalls where the glibc symbol
    name is not the same as the kernel syscall name.
    
    Closes: https://bugs.gentoo.org/751241
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>

 libsandbox/symbols.h.in            |  2 +-
 libsandbox/trace.c                 | 14 +++++++++----
 scripts/gen_symbol_header.awk      |  6 ++++--
 scripts/gen_symbol_version_map.awk |  6 ++++--
 scripts/gen_trace_header.awk       | 42 +++++++++++++++++++++++---------------
 5 files changed, 45 insertions(+), 25 deletions(-)

Additionally, it has been referenced in the following commit(s):

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

commit afa38c053de48152beef9d8bf6726a4710bcba58
Author:     Mike Frysinger <vapier@gentoo.org>
AuthorDate: 2021-10-23 07:25:25 +0000
Commit:     Mike Frysinger <vapier@gentoo.org>
CommitDate: 2021-10-23 22:18:03 +0000

    libsandbox: add 64-bit time_t wrappers
    
    This intercepts the C library 64-bit time_t interfaces.  The syscall
    trace side will need more work first.
    
    Bug: https://bugs.gentoo.org/751241
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>

 libsandbox/symbols.h.in                  |  5 +++++
 libsandbox/wrapper-funcs/__futimesat64.c | 13 +++++++++++++
 libsandbox/wrapper-funcs/__lutimes64.c   | 13 +++++++++++++
 libsandbox/wrapper-funcs/__utime64.c     | 13 +++++++++++++
 libsandbox/wrapper-funcs/__utimensat64.c | 13 +++++++++++++
 libsandbox/wrapper-funcs/__utimes64.c    | 13 +++++++++++++
 libsandbox/wrapper-funcs/futimesat.c     |  4 +++-
 libsandbox/wrapper-funcs/lutimes.c       |  4 +++-
 libsandbox/wrapper-funcs/utime.c         |  4 +++-
 libsandbox/wrapper-funcs/utimensat.c     |  4 +++-
 libsandbox/wrapper-funcs/utimes.c        |  4 +++-
 tests/local.mk                           |  2 ++
 tests/test-skel-0.c                      |  4 ++--
 tests/utimensat64-0.c                    |  3 +++
 tests/utimensat64-1.sh                   |  9 +++++++++
 tests/utimensat64.at                     |  1 +
 tests/utimensat64_static-0.c             |  1 +
 tests/utimensat64_static-1.sh            | 10 ++++++++++
 tests/utimensat64_static.at              |  1 +
 19 files changed, 114 insertions(+), 7 deletions(-)
Comment 6 SpanKY gentoo-dev 2021-10-23 22:21:41 UTC
i didn't overhaul it quite as much as maybe i wanted to, but it seems to work, so going to call it a day for now.  we'll see how the new format works.
Comment 7 SpanKY gentoo-dev 2021-10-23 22:23:47 UTC
i verified that x86, ppc, and hppa all work (and were failing previously with static utimensat due to use of the time 64-bit syscall variant)