Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 379931 - =dev-scheme/racket-5.1.2: Sandbox violation: ldconfig -n /usr/lib called during src_install
Summary: =dev-scheme/racket-5.1.2: Sandbox violation: ldconfig -n /usr/lib called duri...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Scheme Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 406543
  Show dependency tree
 
Reported: 2011-08-20 07:53 UTC by Cyprien Nicolas (fulax)
Modified: 2012-03-02 08:29 UTC (History)
2 users (show)

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


Attachments
dev-scheme/racket-5.1.2 build.log (racket-5.1.2:20110814-160909.log,211.57 KB, text/plain)
2011-08-20 07:53 UTC, Cyprien Nicolas (fulax)
Details
Patch to remove the call to $(MAKE) lib-finish (dont_call_ldconfig_in_src_install.patch,355 bytes, patch)
2011-08-20 07:55 UTC, Cyprien Nicolas (fulax)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cyprien Nicolas (fulax) 2011-08-20 07:53:32 UTC
Created attachment 283987 [details]
dev-scheme/racket-5.1.2 build.log

In src_install, racket's Makefiles call at some point:

  $(MAKE) install-common-middle

which calls:
  $(MAKE) lib-finish

which calls:
  /var/tmp/portage/dev-scheme/racket-5.1.2/work/racket-5.1.2/src/lt/libtool --mode=finish "/usr/lib"

which calls:
  PATH="$PATH:/sbin" ldconfig -n /usr/lib

which results in:
  
ACCESS DENIED  UNLINK:       /usr/lib/libbigloocalendar_es-3.6b.so
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator run these commands:
       PATH="$PATH:/sbin" ldconfig -n /usr/lib
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
 
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[4]: Leaving directory `/var/tmp/portage/dev-scheme/racket-5.1.2/work/racket-5.1.2/src'
make[3]: Leaving directory `/var/tmp/portage/dev-scheme/racket-5.1.2/work/racket-5.1.2/src'
make[2]: Leaving directory `/var/tmp/portage/dev-scheme/racket-5.1.2/work/racket-5.1.2/src'
env CFLAGS="-O2 -march=i686 -pipe     -I/usr/lib/libffi-3.0.9/include   -pthread -DMZ_DONT_USE_JIT" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -pthread"  racket/racket3m -X "/var/tmp/portage/dev-scheme/racket-5.1.2/image//usr/lib/racket/collects" -N "raco setup" -l- setup    --no-user --no-docs
raco setup: bootstrapping from source...

(raco setup snip)

>> Completed installing racket-5.1.2 into /var/tmp/portage/dev-scheme/racket-5.1.2/image/
 
--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE "/var/log/sandbox/sandbox-22625.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: UNLINK
S: deny
P: /usr/lib/libbigloocalendar_es-3.6b.so
A: /usr/lib/libbigloocalendar_es-3.6b.so
R: /usr/lib/libbigloocalendar_es-3.6b.so
C: ldconfig -n /usr/lib
--------------------------------------------------------------------------------



So here is the point (many issues actually):

Sandbox issue: I think this should not happened, but it did

libbigloocalendar_es-3.6b.so no longer exists, the unlink call succeeded

# ls -l /usr/lib/libbigloocalendar_es-3.6b.so
ls: cannot access /usr/lib/libbigloocalendar_es-3.6b.so: No such file or directory

why it should be:

# ls /usr/lib/libbigloomultimedia_es-3.6b.so  -l
lrwxrwxrwx 1 root root 42 Aug  4 20:23 /usr/lib/libbigloomultimedia_es-3.6b.so -> bigloo/3.6b/libbigloomultimedia_es-3.6b.so


Manually calling `ldconfig -n /usr/lib` restore a different link:

# ldconfig -n /usr/lib
# ls /usr/lib/libbigloocalendar_es-3.6b.so -l
lrwxrwxrwx 1 root root 28 Aug 20 09:46 /usr/lib/libbigloocalendar_es-3.6b.so -> libbigloocalendar_eu-3.6b.so

So can this be a dev-scheme/bigloo issue with its libraries too? I haven't try to emerge racket after unmerging bigloo, I'll try it later.


Trying to emerge again racket fails at the same point, ldconfig -n /usr/lib keeps relinking the same libraries again and again, libtool issue?


The work around that work for me is to remove the call to $(MAKE) lib-finish


PS: Looking at the racket-5.1.1 build.log, it called ldconfig -n /usr/lib too, but I didn't get the sandbox violation, I don't know why...
Comment 1 Cyprien Nicolas (fulax) 2011-08-20 07:55:16 UTC
Created attachment 283989 [details, diff]
Patch to remove the call to $(MAKE) lib-finish

Here is the patch that make the build successful on my machine
Comment 2 Marijn Schouten (RETIRED) gentoo-dev 2011-08-23 09:33:52 UTC
Cyprien, so this only happens when certain versions of bigloo[+calendar] are installed? Could you nail that down a bit please?
Comment 3 Cyprien Nicolas (fulax) 2011-08-31 08:36:41 UTC
(In reply to comment #2)
> Cyprien, so this only happens when certain versions of bigloo[+calendar] are
> installed? Could you nail that down a bit please?

This currently happens with bigloo-3.6b[+calendar] from 22Jul11, from my overlay (but the build haven't changed for a while).

Building with USE='-*' emerge bigloo doesn't trigger any sandbox violation.

I'll do more testing soon, with other versions and other USE flags combinations.
Comment 4 Jonathan Lovelace 2011-09-26 17:58:26 UTC
I just hit this with /usr/lib64/libbigloossl_es-3.6a.so from bigloo-3.6a[ssl] (that was the only USE flag I had enabled on bigloo); removing the ssl USE flag from bigloo lets racket compile without incident.

emerge --info:
Portage 2.1.10.11 (hardened/linux/amd64, gcc-4.5.3, glibc-2.11.3-r0, 2.6.39-hardened-r8 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.39-hardened-r8-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T6670_@_2.20GHz-with-gentoo-2.0.3
Timestamp of tree: Wed, 21 Sep 2011 15:15:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.1-r1, 3.1.3-r1
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.4.5, 4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.11.3
Repositories: sunrise java-overlay gentoo-haskell seden stormfront gamerlay-stable wtk local eclipse g-cpan hackport_laptop gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -mtune=core2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-2.2/conf /usr/share/maven-bin-3.0/conf /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /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="-O2 -pipe -mtune=core2"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FEATURES="assume-digests binpkg-logs collision-protect compress-build-logs distlocks ebuild-locks fakeroot fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS=""
GENTOO_MIRRORS="http://mirrors.rit.edu/gentoo/ http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="C"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_US"
MAKEOPTS="-j2 -l5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/sunrise /usr/portage/local/layman/java-overlay /usr/portage/local/layman/haskell /usr/portage/local/layman/seden /usr/portage/local/layman/stormfront /usr/portage/local/layman/gamerlay /usr/portage/local/layman/wtk /usr/local/portage /usr/portage/local/layman/eclipse /usr/portage/local/layman/g-cpan /usr/portage/local/layman/hackport /usr/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 bash-completion berkdb bluetooth bzip2 caps cracklib crypt cxx dri gdbm gpm hardened iconv ipv6 jpeg justify libnotify lm_sensors mmx modules mudflap multilib ncurses nls nptl nptlonly ogg openmp pam pax_kernel pcre perl png policykit pppd python readline session speex sse sse2 sse3 ssl ssse3 startup-notification sysfs tcpd theora truetype udev unicode urandom vorbis xorg zlib" 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" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 stage tables krita karbon braindump" CAMERAS="all" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" NETBEANS_MODULES="apisupport ergonomics cnd harness ide java nb ruby" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel vesa" 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:  CPPFLAGS, CTARGET, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

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

dev-scheme/racket-5.1.2 was built with the following:
USE="X (multilib) test -backtrace -cairo -doc -futures -jit -places -plot -threads"
Comment 5 Marijn Schouten (RETIRED) gentoo-dev 2012-01-10 09:30:41 UTC
Right, so I just hit this myself too :(

IIUC then racket shouldn't be calling ldconfig itself at all. Portage will take care of calling that.

Sandbox team: any comment on the sandbox violation which isn't blocked from unlinking a file or the reason it wants to unlink that file?

I'll email both upstreams for comments and resolution.
Comment 6 Marijn Schouten (RETIRED) gentoo-dev 2012-01-10 10:19:07 UTC
So for me the sandbox violation shows up to me as:

--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE "/var/log/sandbox/sandbox-25642.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: UNLINK
S: deny
P: /usr/lib64/libbigloobdl_es-3.6a.so
A: /usr/lib64/libbigloobdl_es-3.6a.so
R: /usr/lib64/libbigloobdl_es-3.6a.so
C: ldconfig -n /usr/lib64 
--------------------------------------------------------------------------------

before:
$ ls -l `equery f bigloo | grep libbigloobdl`
-rw-r--r-- 1 root root   2872 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_es-3.6a.a
-rw-r--r-- 1 root root   6240 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_es-3.6a.so
-rw-r--r-- 1 root root   2872 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_eu-3.6a.a
-rw-r--r-- 1 root root   6240 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_eu-3.6a.so
-rw-r--r-- 1 root root 278176 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_s-3.6a.a
-rw-r--r-- 1 root root 152408 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_s-3.6a.so
lrwxrwxrwx 1 root root     21 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_u-3.6a.a -> libbigloobdl_s-3.6a.a
lrwxrwxrwx 1 root root     22 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_u-3.6a.so -> libbigloobdl_s-3.6a.so
lrwxrwxrwx 1 root root     35 10 jan 10:55 /usr/lib64/libbigloobdl_es-3.6a.so -> bigloo/3.6a/libbigloobdl_es-3.6a.so
lrwxrwxrwx 1 root root     35 10 jan 10:55 /usr/lib64/libbigloobdl_eu-3.6a.so -> bigloo/3.6a/libbigloobdl_eu-3.6a.so
lrwxrwxrwx 1 root root     34 10 jan 10:55 /usr/lib64/libbigloobdl_s-3.6a.so -> bigloo/3.6a/libbigloobdl_s-3.6a.so
lrwxrwxrwx 1 root root     34 10 jan 10:55 /usr/lib64/libbigloobdl_u-3.6a.so -> bigloo/3.6a/libbigloobdl_u-3.6a.so
-rw-r--r-- 1 root root  14412 10 jan 10:55 /usr/lib/debug/usr/lib64/bigloo/3.6a/libbigloobdl_es-3.6a.so.debug
-rw-r--r-- 1 root root  14412 10 jan 10:55 /usr/lib/debug/usr/lib64/bigloo/3.6a/libbigloobdl_eu-3.6a.so.debug
-rw-r--r-- 1 root root 638279 10 jan 10:55 /usr/lib/debug/usr/lib64/bigloo/3.6a/libbigloobdl_s-3.6a.so.debug

after:
$ ls -l `equery f bigloo | grep libbigloobdl`
ls: cannot access /usr/lib64/libbigloobdl_es-3.6a.so: No such file or directory
-rw-r--r-- 1 root root   2872 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_es-3.6a.a
-rw-r--r-- 1 root root   6240 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_es-3.6a.so
-rw-r--r-- 1 root root   2872 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_eu-3.6a.a
-rw-r--r-- 1 root root   6240 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_eu-3.6a.so
-rw-r--r-- 1 root root 278176 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_s-3.6a.a
-rw-r--r-- 1 root root 152408 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_s-3.6a.so
lrwxrwxrwx 1 root root     21 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_u-3.6a.a -> libbigloobdl_s-3.6a.a
lrwxrwxrwx 1 root root     22 10 jan 10:55 /usr/lib64/bigloo/3.6a/libbigloobdl_u-3.6a.so -> libbigloobdl_s-3.6a.so
lrwxrwxrwx 1 root root     35 10 jan 10:55 /usr/lib64/libbigloobdl_eu-3.6a.so -> bigloo/3.6a/libbigloobdl_eu-3.6a.so
lrwxrwxrwx 1 root root     34 10 jan 10:55 /usr/lib64/libbigloobdl_s-3.6a.so -> bigloo/3.6a/libbigloobdl_s-3.6a.so
lrwxrwxrwx 1 root root     34 10 jan 10:55 /usr/lib64/libbigloobdl_u-3.6a.so -> bigloo/3.6a/libbigloobdl_u-3.6a.so
-rw-r--r-- 1 root root  14412 10 jan 10:55 /usr/lib/debug/usr/lib64/bigloo/3.6a/libbigloobdl_es-3.6a.so.debug
-rw-r--r-- 1 root root  14412 10 jan 10:55 /usr/lib/debug/usr/lib64/bigloo/3.6a/libbigloobdl_eu-3.6a.so.debug
-rw-r--r-- 1 root root 638279 10 jan 10:55 /usr/lib/debug/usr/lib64/bigloo/3.6a/libbigloobdl_s-3.6a.so.debug

so the sandbox did indeed not block that unlink.
Comment 7 SpanKY gentoo-dev 2012-01-10 21:01:39 UTC
please fork a new bug for sandbox (you can use the clone bug option here).  ldconfig is a static binary, and so has its own hooks for catching accesses, so i wouldn't be surprised if a few points were missed.
Comment 8 Marijn Schouten (RETIRED) gentoo-dev 2012-03-02 08:29:32 UTC
The racket part of this bug is now fixed upstream by making the call to whatever calls ldconfig dependent on empty D. For the sandbox part of this bug I've finally cloned this bug: 406543.