Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 694966 - sys-apps/firejail profiles for strings and fontforge breake installation of media-libs/x264 and app-office/libreoffice
Summary: sys-apps/firejail profiles for strings and fontforge breake installation of m...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Hank Leininger
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: 769731
  Show dependency tree
 
Reported: 2019-09-19 14:04 UTC by Øyvind
Modified: 2022-02-18 02:44 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Øyvind 2019-09-19 14:04:59 UTC
Portage 2.3.69 (python 3.6.5-final-0, default/linux/amd64/17.1/hardened/selinux, gcc-8.3.0, glibc-2.29-r2, 4.19.66-gentoo x86_64)
=================================================================
System uname: Linux-4.19.66-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E5-1650_v3_@_3.50GHz-with-gentoo-2.6
KiB Mem:    32892504 total,   8256328 free
KiB Swap:   50868948 total,  50842824 free
Timestamp of repository gentoo: Thu, 19 Sep 2019 13:00:01 +0000
Head commit of repository gentoo: ee5f74aa1bfc5554006d78ad0dbc9ce3b0baa7c3
Head commit of repository GentooStudio: 6826704b0a41f64bc8fff8da4d3ca78ade604dc9

sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo
Repositories:

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

GentooStudio
    location: /usr/local/portage
    sync-type: git
    sync-uri: https://github.com/audiodef/gentoostudio.git
    masters: gentoo

crossdev
    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10

cg
    location: /var/lib/layman/cg
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=haswell -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/sddm/scripts/Xsetup"
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=haswell -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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 config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo rsync://ftp.snt.utwente.nl/gentoo ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo ftp://mirror.mdfnet.se/gentoo http://mirror.mdfnet.se/gentoo"
LANG="nb_NO.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j12"
PKGDIR="/usr/portage/packages"
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="X acl alsa amd64 bzip2 crypt cxx dbus elogind exif fontconfig gdbm git gles gphoto2 graphviz gtk handbook hardened iconv introspection ipv6 jack jpeg kde libtirpc multilib ncurses nls nptl opencl opengl openmp pam pcre pdf peer_perms pie plasma policykit pulseaudio python qt5 raw readline ruby seccomp selinux smartcard smp sound split-usr ssl ssp threads truetype unicode vim-syntax wayland xattr xft xtpax zlib zsh-completion" 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 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="libinput keyboard mouse" KERNEL="linux" L10N="en no nb nn" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="x86_64" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi radeon" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Øyvind 2019-09-19 16:10:15 UTC
steps to reproduce:

1 - install firejail
2 - run sudo firecfg to enable firejail for all supported programms
3 - try to install libreoffice or x264
Comment 2 Jonas Stein gentoo-dev 2020-09-10 13:56:03 UTC
This was marked "IN_PROGRESS" on 2019-09-29. Any news?
Comment 3 Dennis Lamm gentoo-dev 2020-09-25 12:32:34 UTC
Not really, hadn't found a good solution so far. Solutions or Ideas are welcome.
Comment 4 Hank Leininger 2020-11-14 20:18:00 UTC
I think this boils down to an interaction between firejail being setuid, and libsandbox.so being loaded by portage during emerges by using LD_ environment variables, which isn't allowed/respected for setuid bins.

Working on a short-term fix for this, you can play along at home: edit /usr/lib64/firejail/firecfg.config, comment out the problematic items[*], and then run firecfg --clean ; firecfg ; hash -r

[*] My current list is patch, strings, and fontforge; will do an emerge -e world to see what else I can identify.

Once I have a somewhat-complete list, I'll modify our ebuild to disable the  problematic ones by default.

Upstream already has some entries commented out with notes about Arch issues, so they're receptive; I'll open an issue and PR there as well.

A potential longer-term option could be to entirely bypass firejail for user portage doing builds. Combine something like a firejail group (see https://bugs.gentoo.org/663784) that excludes the portage user, set firecfg's default bindir to something like /usr/lib/firejail/bin/ (see firecfg's --bindir argument), and an env.d/ file that prepends that dir to $PATH only if the user is a member of the firejail group.
Comment 5 Larry the Git Cow gentoo-dev 2022-02-18 02:44:23 UTC
The bug has been closed via the following commit(s):

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

commit f83326db36c6215b3fb69cf9630c5e3b53d32c43
Author:     Hank Leininger <hlein@korelogic.com>
AuthorDate: 2022-02-07 04:40:48 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-02-18 02:38:46 +0000

    sys-apps/firejail: version bump, remove old, Gentoo compat tweaks
    
    Upstream released a security bump. Also, added some fixes and
    workarounds for bits & configs that break on Gentoo.
    
    Signed-off-by: Hank Leininger <hlein@korelogic.com>
    Bug: https://bugs.gentoo.org/832819
    Closes: https://bugs.gentoo.org/694966
    Closes: https://bugs.gentoo.org/663784
    Package-Manager: Portage-3.0.30, Repoman-3.0.3
    Closes: https://github.com/gentoo/gentoo/pull/24102
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/firejail/Manifest                         |  3 +-
 sys-apps/firejail/files/firecfg.config.patch       | 71 ++++++++++++++++
 .../firejail/files/firejail-0.9.68-envlimits.patch | 12 +++
 sys-apps/firejail/files/profile_display.local      |  2 +
 sys-apps/firejail/files/profile_patch.local        |  8 ++
 sys-apps/firejail/files/profile_pdftotext.local    |  2 +
 sys-apps/firejail/files/profile_wget.local         |  5 ++
 sys-apps/firejail/firejail-0.9.64.4.ebuild         | 99 ----------------------
 ...rejail-0.9.66.ebuild => firejail-0.9.68.ebuild} | 27 +++++-
 sys-apps/firejail/firejail-9999.ebuild             |  8 +-
 10 files changed, 128 insertions(+), 109 deletions(-)