Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 634584 - dac_read_search permission spam when using emerge to install packages
Summary: dac_read_search permission spam when using emerge to install packages
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: SELinux (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: SE Linux Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-17 21:23 UTC by Amadeusz Sławiński
Modified: 2018-10-24 09:35 UTC (History)
0 users

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


Attachments
allow dac_read_search along with dac_override (0001-allow-dac_read_search-along-with-dac_override.patch,1.37 KB, patch)
2017-10-18 10:34 UTC, Amadeusz Sławiński
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Amadeusz Sławiński 2017-10-17 21:23:59 UTC
[  683.410404] audit: type=1400 audit(1508274731.211:1769): avc:  denied  { dac_read_search } for  pid=4203 comm="ebuild.sh" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
[  683.410957] audit: type=1400 audit(1508274731.211:1770): avc:  denied  { dac_read_search } for  pid=4203 comm="ebuild.sh" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
...
[  708.355087] audit: type=1400 audit(1508274756.155:1815): avc:  denied  { dac_read_search } for  pid=5729 comm="ebuild.sh" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
[  708.383037] audit: type=1400 audit(1508274756.183:1816): avc:  denied  { dac_read_search } for  pid=5743 comm="emake" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
...
[  708.400225] audit: type=1400 audit(1508274756.201:1822): avc:  denied  { dac_read_search } for  pid=5745 comm="make" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
[  720.111473] audit: type=1400 audit(1508274767.912:2026): avc:  denied  { dac_read_search } for  pid=6503 comm="ebuild.sh" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
...
[  762.545926] audit: type=1400 audit(1508274810.346:2116): avc:  denied  { dac_read_search } for  pid=9174 comm="ebuild.sh" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
[  762.575869] audit: type=1400 audit(1508274810.376:2117): avc:  denied  { dac_read_search } for  pid=9188 comm="emake" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
[  762.575874] audit: type=1400 audit(1508274810.376:2118): avc:  denied  { dac_read_search } for  pid=9188 comm="emake" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0
[  762.584722] audit: type=1400 audit(1508274810.385:2119): avc:  denied  { dac_read_search } for  pid=9190 comm="make" capability=2  scontext=staff_u:sysadm_r:portage_sandbox_t tcontext=staff_u:sysadm_r:portage_sandbox_t tclass=capability permissive=0


# dmesg | grep avc: | grep -c dac
193


# emerge --info portage
Portage 2.3.11 (python 3.4.6-final-0, hardened/linux/amd64/no-multilib/selinux, gcc-6.4.0, glibc-2.25-r7, 4.13.7 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.13.7-x86_64-Intel-R-_Core-TM-_i3_CPU_M_350_@_2.27GHz-with-gentoo-2.4.1
KiB Mem:     8022332 total,   6386592 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 17 Oct 2017 00:45:01 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p2) 2.29.1
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.26.1::gentoo
dev-lang/python:          2.7.14::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.9.4::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.33::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0::gentoo
sys-devel/gcc-config:     1.9.0::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: webrsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    eclass-overrides: amade-overlay

amade-overlay
    location: /usr/local/overlay
    masters: gentoo
    priority: 0
    eclass-overrides: amade-overlay

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -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 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
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 aac acl acpi alsa amd64 audit berkdb bluetooth bzip2 caps cli cracklib crypt cxx dbus dri ffmpeg flac gdbm gif git gnutls gold gpg gtk3 hardened iconv introspection ipv6 jpeg jpeg2k justify mng modules mp3 ncurses nls nptl ogg open_perms opengl openmp pam pcre pie png policykit readline seccomp selinux session ssl ssp svg tcpd theora threads tiff udev udisks unicode upower urandom usb v4l vaapi vdpau vim-syntax vorbis x264 xattr xcb xft xinerama xpm xrandr xtpax zlib zsh-completion" ABI_X86="64" 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="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext 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" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" L10N="en en_GB pl" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="x86_64 ppc" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="nouveau" 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, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

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

sys-apps/portage-2.3.11::gentoo was built with the following:
USE="(ipc) native-extensions (selinux) (xattr) -build -doc -epydoc" LINGUAS="-ru" PYTHON_TARGETS="python2_7 python3_4 (-pypy) -python3_5 -python3_6"
Comment 1 Amadeusz Sławiński 2017-10-17 21:41:49 UTC
As per https://danwalsh.livejournal.com/77140.html the order in which kernel checks permissions changed.

I tried just using dac_read_search, but portage instantly balked out. So it needs both of them. I guess dac_read_search could probably be dontaudited instead, but as I understand dac_read_search is subset of dac_override, so it should be ok to allow both.

Proposed fix:

https://github.com/amade/hardened-refpolicy/commit/bd2f3bee3c9585af5ff0405428178392a8f38b3b
Comment 2 Amadeusz Sławiński 2017-10-18 10:34:46 UTC
Created attachment 499064 [details, diff]
allow dac_read_search along with dac_override

and attach patch for history