Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831897 - dev-lang/python[pgo]: sandbox violation on has_version
Summary: dev-lang/python[pgo]: sandbox violation on has_version
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-01-23 11:43 UTC by Albert W. Hopkins
Modified: 2022-03-19 00:06 UTC (History)
4 users (show)

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


Attachments
build.log (build.log,498.07 KB, text/plain)
2022-01-23 11:43 UTC, Albert W. Hopkins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Albert W. Hopkins 2022-01-23 11:43:13 UTC
Created attachment 763372 [details]
build.log

Suddenly Python (re)builds are failing on sandbox violations.

>>> Source compiled.
 * ----------------------- SANDBOX ACCESS VIOLATION SUMMARY -----------------------
 * LOG FILE: "/var/tmp/portage/dev-lang/python-3.10.2/temp/sandbox.log"
 * 
VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: open_wr
S: deny
P: /usr/lib/python3.10/__pycache__/_sysconfigdata__linux_x86_64-linux-gnu.cpython-310.pyc.140358586755392
A: /usr/lib/python3.10/__pycache__/_sysconfigdata__linux_x86_64-linux-gnu.cpython-310.pyc.140358586755392
R: /usr/lib/python3.10/__pycache__/_sysconfigdata__linux_x86_64-linux-gnu.cpython-310.pyc.140358586755392
C: /usr/bin/python3.10 /usr/lib/portage/python3.10/ebuild-ipc.py has_version / dev-libs/libffi[pax-kernel] 
 * --------------------------------------------------------------------------------
Comment 1 Jonas Stein gentoo-dev 2022-01-23 17:02:07 UTC Comment hidden (obsolete)
Comment 2 Albert W. Hopkins 2022-01-23 17:21:18 UTC
Jonas,

I'm not sure what information you need, but this seems to be an issue with the ebuild (or portage or sandbox). The problem is that I'm trying to build dev-lang/python (both 3.10.2 and 3.10.0_p1-r1 seem to be effected) and the builds are encountering sandbox violations (as pasted above).

I don't think this is a but with the system but that these builds are suddenly attempting to break out of the portage sandbox.

Is there any other information I can provide to assist?
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-23 17:22:55 UTC
Could you include:
- emerge --info for completeness (in part because it contains sandbox info, but we always want it anyway)
- /var/tmp/portage/dev-lang/python-3.10.2/temp/sandbox.log if it exists?
Comment 4 Albert W. Hopkins 2022-01-23 19:39:12 UTC
The sandbox.log file doesn't seem to exist.

Here is the emerge --info

Portage 3.0.30 (python 3.10.2-final-0, default/linux/amd64/17.1/no-multilib, gcc-11.2.1, glibc-2.34-r6, 5.15.13-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.15.13-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E5-2630_0_@_2.30GHz-with-glibc2.34
KiB Mem:    32877328 total,   5192404 free
KiB Swap:   13609976 total,  13601272 free
Timestamp of repository gentoo: Sun, 23 Jan 2022 16:32:49 +0000
Timestamp of repository marduk: Fri, 14 Jan 2022 01:45:09 +0000
sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p1) 2.37
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.0-r6::gentoo
dev-lang/python:           3.9.10::gentoo, 3.10.2::gentoo
dev-lang/rust:             1.58.1::gentoo
dev-util/cmake:            3.22.1::gentoo
dev-util/meson:            0.60.3::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-apps/systemd:          250.3::gentoo
sys-devel/autoconf:        2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.37_p1-r1::gentoo
sys-devel/binutils-config: 5.4::gentoo
sys-devel/clang:           13.0.0::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/lld:             13.0.0::gentoo
sys-devel/llvm:            13.0.0::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.16::gentoo (virtual/os-headers)
sys-libs/glibc:            2.34-r6::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://gbp/repos/lighthouse/gentoo
    priority: -1000
    sync-rsync-verify-metamanifest: False
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

marduk
    location: /var/db/repos/marduk
    sync-type: rsync
    sync-uri: rsync://gbp/repos/lighthouse/marduk
    masters: gentoo
    priority: 50
    sync-rsync-verify-metamanifest: False
    sync-rsync-extra-opts: 

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="     -O2     -march=native     -mtune=tigerlake     -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"
CXXFLAGS="     -O2     -march=native     -mtune=tigerlake     -pipe "
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="     --autounmask=n     --binpkg-changed-deps     --binpkg-respect-use     --buildpkg     --changed-deps=y     --color=y     --getbinpkg     --jobs=4     --keep-going     --oneshot     --quiet-build     --quiet-unmerge-warn     --rebuilt-binaries=y     --verbose-conflicts     --with-bdeps=n "
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"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks fixlafiles multilib-strict news noinfo notitles parallel-fetch preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms skiprocheck strict unknown-features-warn unmerge-logs unmerge-orphans xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/share/doc"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="     --jobs=5     --load-average=5.64 "
PKGDIR="/var/cache/binpkgs"
PORTAGE_BINHOST="https://gbp/binpkgs/lighthouse/"
PORTAGE_COMPRESS=""
PORTAGE_COMPRESS_FLAGS=""
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="acl aes amd64 asm avx avx2 avx512bw avx512cd avx512dq avx512f avx512vbmi avx512vl f16c fma3 glamor introspection ipv6 jpeg2k libglvnd mmx mmxext nls nptl opentype pam pclmul popcnt rdrand seccomp sha split-usr sse sse2 sse3 sse4_1 sse4_2 ssse3 systemd udev unicode urandom utf8 vaapi vulkan wayland xattr" ABI_X86="64" APACHE2_MODULES="auth_digest authn_core authn_file authz authz_core authz_groupfile authz_host authz_user dav dav_fs dir group_file mime socache_shmcb unixd" APACHE2_MPMS="prefork" CAMERAS="*" CPU_FLAGS_X86="aes avx avx2 avx512f avx512dq avx512cd avx512bw avx512vl avx512vbmi f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" ELIBC="glibc" FFTOOLS="*" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en" LLVM_TARGETS="AArch64 AMDGPU ARM AVR BPF Hexagon Lanai MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore" LUA_SINGLE_TARGET="lua5-4" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="intel i965 iris"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SHELL, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

dev-lang/python-3.10.2::gentoo was built with the following:
USE="gdbm lto ncurses pgo readline sqlite ssl xml -bluetooth -build -examples -hardened -libedit -test -tk -verify-sig -wininst"
CFLAGS="-O2 -march=native -mtune=tigerlake -pipe -fwrapv"
CXXFLAGS="-O2 -march=native -mtune=tigerlake -pipe -fwrapv"
FEATURES="preserve-libs binpkg-docompress binpkg-multi-instance distlocks binpkg-dostrip sfperms sandbox protect-owned buildpkg-live assume-digests strict qa-unresolved-soname-deps xattr news unmerge-orphans config-protect-if-modified parallel-fetch binpkg-logs fixlafiles unknown-features-warn unmerge-logs skiprocheck buildpkg multilib-strict notitles noinfo"
Comment 5 Marius Dinu 2022-02-09 18:46:04 UTC
I get the same error.
My Gentoo is installed on a USB stick. I removed python cache and object files for more space on the stick.
I have PYTHONDONTWRITEBYTECODE=1 in make.conf. I also tried setting it in /etc/env.d and package.env -> /etc/portage/env/. No change.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-02-10 05:18:33 UTC
Do all versions in tree now fail?
Comment 7 marius 2022-02-11 10:50:06 UTC
All 3.9.*, 3.10.* and 3.11.* ebuilds fail. I tested all of them.
v3.8.12_p1-r2 is the last one working.
Comment 8 Marius Dinu 2022-02-12 19:42:27 UTC
May be related: Newer python builds and runs lots of tests, even if test use flag is not enabled. Compilation takes a lot more time than v3.8.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-18 19:04:22 UTC
(In reply to Marius Dinu from comment #8)
> May be related: Newer python builds and runs lots of tests, even if test use
> flag is not enabled. Compilation takes a lot more time than v3.8.

That is almost certainly USE=pgo?
Comment 10 Marius Dinu 2022-03-18 20:06:09 UTC
Yes, I added pgo in make.conf.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-18 21:11:20 UTC
(In reply to Marius Dinu from comment #10)
> Yes, I added pgo in make.conf.

Then it's doing what it's supposed to - it run tests, profiles them, then uses the results to optimise Python.

(Note that USE=test doesn't control tests either, just deps, use FEATURES=test for that, but this is independent of PGO.)
Comment 12 Larry the Git Cow gentoo-dev 2022-03-19 00:06:05 UTC
The bug has been closed via the following commit(s):

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

commit d5d4b491db81d7cfc47093f66dfbd097fc4a2dc2
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-03-18 19:31:21 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-03-19 00:05:46 +0000

    dev-lang/python: save/restore PYTHONDONTWRITEBYTECODE for USE=pgo
    
    This avoids writing bytecode when we call has_version (or make
    any other calls). But we do need it on for the 'emake' call
    when building w/ USE=pgo.
    
    Save & restore the value from the environment before/after
    emake if building with PGO.
    
    Closes: https://bugs.gentoo.org/831897
    Signed-off-by: Sam James <sam@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/24642
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/python/python-3.10.3.ebuild        | 8 ++++++++
 dev-lang/python/python-3.11.0_alpha6.ebuild | 8 ++++++++
 dev-lang/python/python-3.9.11.ebuild        | 8 ++++++++
 3 files changed, 24 insertions(+)