Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 547028 - sys-kernel/cryptodev-1.7 : uses the host kernel instead of the guest (chroot) kernel
Summary: sys-kernel/cryptodev-1.7 : uses the host kernel instead of the guest (chroot)...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LABBE Corentin
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-18 18:27 UTC by Toralf Förster
Modified: 2015-04-25 09:36 UTC (History)
2 users (show)

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


Attachments
emerge log (sys-kernel-cryptodev-1.7-20150418-170751.log,2.20 KB, text/plain)
2015-04-18 18:27 UTC, Toralf Förster
Details
Add an headers-only use flag (cryptodev-noheaders.patch,1.46 KB, patch)
2015-04-22 06:48 UTC, LABBE Corentin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2015-04-18 18:27:28 UTC
Created attachment 401568 [details]
emerge log

These are the packages that would be merged, in reverse order:

Calculating dependencies  ... done!
[ebuild  N     ] sys-kernel/cryptodev-1.7  USE="-examples" 

>>> Verifying ebuild manifests
>>> Running pre-merge checks for sys-kernel/cryptodev-1.7
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/4.0.0-rc7/build
 * Found sources for kernel version:
 *     4.0.0-rc7
 * Checking for suitable kernel configuration options...
 [ ok ]
>>> Jobs: 0 of 1 complete, 1 running                Load avg: 3.62, 3.58, 4.33
>>> Emerging (1 of 1) sys-kernel/cryptodev-1.7::gentoo
>>> Jobs: 0 of 1 complete, 1 running                Load avg: 3.62, 3.58, 4.33
>>> Failed to emerge sys-kernel/cryptodev-1.7, Log file:
>>> Jobs: 0 of 1 complete, 1 running                Load avg: 3.65, 3.58, 4.33
>>>  '/var/log/portage/sys-kernel:cryptodev-1.7:20150418-170751.log'
>>> Jobs: 0 of 1 complete, 1 running                Load avg: 3.65, 3.58, 4.33
>>> Jobs: 0 of 1 complete, 1 running, 1 failed      Load avg: 3.65, 3.58, 4.33
>>> Jobs: 0 of 1 complete, 1 failed                 Load avg: 3.65, 3.58, 4.33

 * Package:    sys-kernel/cryptodev-1.7
 * Repository: gentoo
 * Maintainer: clabbe.montjoie@gmail.com proxy-maint@gentoo.org
 * USE:        abi_x86_64 amd64 elibc_glibc kernel_linux userland_GNU
 * FEATURES:   preserve-libs sandbox userpriv usersandbox
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/4.0.0-rc7/build
 * Found sources for kernel version:
 *     4.0.0-rc7
>>> Unpacking source...
>>> Unpacking cryptodev-linux-1.7.tar.gz to /var/tmp/portage/sys-kernel/cryptodev-1.7/work
>>> Source unpacked in /var/tmp/portage/sys-kernel/cryptodev-1.7/work
>>> Preparing source in /var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7 ...
ln: failed to create symbolic link ‘Module.symvers’: File exists
 * Preparing cryptodev module
make -j1 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' build 
make -C /lib/modules/3.19.4-hardened/build SUBDIRS=`pwd` ARCH=x86 CROSS_COMPILE=x86_64-pc-linux-gnu- modules
make[1]: *** /lib/modules/3.19.4-hardened/build: No such file or directory.  Stop.
Makefile:25: recipe for target 'build' failed
make: *** [build] Error 2
 * ERROR: sys-kernel/cryptodev-1.7::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-kernel/cryptodev-1.7::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-kernel/cryptodev-1.7::gentoo'`.
 * The complete build log is located at '/var/log/portage/sys-kernel:cryptodev-1.7:20150418-170751.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-kernel/cryptodev-1.7/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-kernel/cryptodev-1.7/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7'
 * S: '/var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7'

The log is stored in /var/log/portage/_emerge_20150418-190754.log.
quick search: https://bugs.gentoo.org/buglist.cgi?quicksearch=sys-kernel%2Fcryptodev
Maintainer :  clabbe.montjoie@gmail.com proxy-maint@gentoo.org
maintainer : clabbe.montjoie@gmail.com
herd       : proxy-maintainers

This is an unstable amd64 chroot image (named amd64-unstable_20150414) at a hardened host acting as a tinderbox.

Portage 2.2.18 (python 2.7.9-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.9.2, glibc-2.20-r2, 3.19.4-hardened x86_64)
=================================================================
System uname: Linux-3.19.4-hardened-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16164756 total,   3816536 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 18 Apr 2015 12:00:01 +0000
sh bash 4.3_p33-r2
ld GNU ld (Gentoo 2.25 p1.0) 2.25
app-shells/bash:          4.3_p33-r2::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r2::gentoo, 3.3.5-r1::gentoo
dev-util/cmake:           3.2.1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.13.11::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.9.6-r4::gentoo, 1.10.3-r1::gentoo, 1.11.6-r1::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25::gentoo
sys-devel/gcc:            4.8.4::gentoo, 4.9.2::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.0::gentoo (virtual/os-headers)
sys-libs/glibc:           2.20-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

toralf
    location: /usr/local/portage
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/entropy /opt/openfire/resources/security/ /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/qpsmtpd/plugins /var/lib/hsqldb /var/spool/torque"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/games/angband/edit/ /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /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=native -O2 -pipe"
DISTDIR="/var/tmp/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --tree --quiet-build --jobs 1"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo rsync://mirror.netcologne.de/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gor.bytemark.co.uk/gentoo/ rsync://ftp.snt.utwente.nl/gentoo"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
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"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi aes-ni alsa amd64 apache2 avx avx2 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit corefonts cracklib crypt cups cxx dbus declarative designer dnssec dot dri drmkms dts dvd dvdr ecc emboss encode exif extraengine fam ffmpeg firefox flac fontconfig fortran fpm gd gdbm gif glamor gpm gtk gudev gui iconv icu isag jadetex jpeg kde kipi kvm lapack lcms libkms libnotify libvirtd logrotate mad mbox minizip mmx mmxext mng modules mp3 mp4 mpeg multilib mysql ncurses nls nptl ogg opengl openmp openssl pam pango pax_kernel pcre pcre16 pdf phonon plasma png policykit ppds pwquality python qemu qt3support qt4 readline scrpyt sdl session spell spice sqlite sse sse2 sse4 sse4_1 sse4_2 ssh-askpass ssl ssse3 startup-notification svg tcpd theora thinkpad threads tiff tk tls truetype udev udisks uml unicode upower usb usbredir uxa v4l v4l2 video vorbis wxwidgets x264 xa xcb xcomposite xinerama xkb xml xmp xscreensaver xslt xv xvfb xvid xvmc zenmap zlib" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" 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 ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 LABBE Corentin 2015-04-22 06:41:24 UTC
For me building the kernel module is only valid on the host, a chroot do not need to have it.

Furthermore, I inherit and use linux-mod like all other ebuilds the builds kernel modules, I do not see what can be modified on my ebuild.

So, perhaps you build cryptodev just for having the headers (and building openssl with it for example).
I propose to add an use flag to control the build of the kernel modules like headers-only.
Comment 2 LABBE Corentin 2015-04-22 06:48:33 UTC
Created attachment 401776 [details, diff]
Add an headers-only use flag
Comment 3 Markos Chandras (RETIRED) gentoo-dev 2015-04-23 21:00:29 UTC
I don't understand this bug. So you say you build the package inside a chroot and this somehow escapes the chroot and uses the host /usr/src/linux? I am not sure how is that possible.

For me, the ebuild looks ok so if there is something that's missing we need some help from the kernel team.
Comment 4 Toralf Förster gentoo-dev 2015-04-23 21:11:42 UTC
it is a tinderbox chroot, which has (randomly) installed apckages, aong them :

$ ls -l amd64-unstable_20150414/usr/src/
total 4
lrwxrwxrwx 1 root root   13 Apr 16 11:35 linux -> linux-4.0-rc7
drwxr-xr-x 1 root root  414 Apr 17 11:28 linux-3.10.7-rsbac
drwxr-xr-x 1 root root  804 Apr 14 14:45 linux-3.18.11-gentoo
drwxr-xr-x 1 root root  822 Apr 15 15:47 linux-3.18.11-rt7
drwxr-xr-x 1 root root  792 Apr 15 18:57 linux-3.18.5-vserver-2.3.7.3
drwxr-xr-x 1 root root  412 Apr 18 23:43 linux-3.19.4-hardened
drwxr-xr-x 1 root root  404 Apr 23 14:40 linux-3.19.4-tuxonice
drwxr-xr-x 1 root root  392 Apr 23 13:23 linux-4.0.0
drwxr-xr-x 1 root root  404 Apr 16 18:04 linux-4.0.0-gentoo
drwxr-xr-x 1 root root  814 Apr 17 16:40 linux-4.0-rc7
drwxr-xr-x 1 root root   52 Apr 18 00:56 rpm
drwxr-xr-x 1 root root 1774 Apr 18 13:16 snort_dynamicsrc
Comment 5 Markos Chandras (RETIRED) gentoo-dev 2015-04-24 19:38:46 UTC
Hmm i think it all boils down to get_running_version() function from linux-info.eclass. That uses uname -r to detect the running kernel which does not play well in the chroot. I am not sure why this function is even called. Can you try to disable the quiet build and see if we can get a few more details from the build log?
Comment 6 Toralf Förster gentoo-dev 2015-04-24 21:19:55 UTC
(In reply to Markos Chandras from comment #5)
> Hmm i think it all boils down to get_running_version() function from
> linux-info.eclass. That uses uname -r to detect the running kernel which
> does not play well in the chroot. I am not sure why this function is even
> called. Can you try to disable the quiet build and see if we can get a few
> more details from the build log?

tinderbox@tor-relay ~ $ sudo ./chr.sh amd64-unstable_20150414
tor-relay / # emerge -1  sys-kernel/cryptodev

These are the packages that would be merged, in reverse order:

Calculating dependencies  ...... done!
[ebuild  N     ] sys-kernel/cryptodev-1.7  USE="-examples"                                              
                                                                                                        
                                                                                                        
>>> Verifying ebuild manifests                                                                          
>>> Running pre-merge checks for sys-kernel/cryptodev-1.7                                               
 * Determining the location of the kernel source code                                                   
 * Found kernel source directory:                                                                       
 *     /usr/src/linux                                                                                   
 * Found kernel object directory:                                                                       
 *     /lib/modules/4.0.0-rc7/build                                                                     
 * Found sources for kernel version:
 *     4.0.0-rc7
 * Checking for suitable kernel configuration options...                                         [ ok ]

>>> Emerging (1 of 1) sys-kernel/cryptodev-1.7::gentoo
 * cryptodev-linux-1.7.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...                               [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/4.0.0-rc7/build
 * Found sources for kernel version:
 *     4.0.0-rc7
>>> Unpacking source...
>>> Unpacking cryptodev-linux-1.7.tar.gz to /var/tmp/portage/sys-kernel/cryptodev-1.7/work
>>> Source unpacked in /var/tmp/portage/sys-kernel/cryptodev-1.7/work
>>> Preparing source in /var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7 ...
ln: failed to create symbolic link ‘Module.symvers’: File exists
 * Preparing cryptodev module
make -j1 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' build
make -C /lib/modules/3.19.5-hardened/build SUBDIRS=`pwd` ARCH=x86 CROSS_COMPILE=x86_64-pc-linux-gnu- modules
make[1]: *** /lib/modules/3.19.5-hardened/build: No such file or directory.  Stop.
Makefile:25: recipe for target 'build' failed
make: *** [build] Error 2
 * ERROR: sys-kernel/cryptodev-1.7::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=sys-kernel/cryptodev-1.7::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-kernel/cryptodev-1.7::gentoo'`.
 * The complete build log is located at '/var/log/portage/sys-kernel:cryptodev-1.7:20150424-211928.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-kernel/cryptodev-1.7/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-kernel/cryptodev-1.7/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7'
 * S: '/var/tmp/portage/sys-kernel/cryptodev-1.7/work/cryptodev-linux-1.7'

>>> Failed to emerge sys-kernel/cryptodev-1.7, Log file:

>>>  '/var/log/portage/sys-kernel:cryptodev-1.7:20150424-211928.log'
tor-relay / # grep OPTS /etc/portage/make.conf
EMERGE_DEFAULT_OPTS="--nospinner --tree  --jobs 1"
MAKEOPTS="-j1"
Comment 7 Markos Chandras (RETIRED) gentoo-dev 2015-04-24 21:35:18 UTC
I am wondering if this could be a problem with the makefile

https://github.com/cryptodev-linux/cryptodev-linux/blob/master/Makefile

in particular line 16

KERNEL_DIR is set to

KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build

which is obviously wrong for us.

Can you try the following patch please?

Index: cryptodev-1.7.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-kernel/cryptodev/cryptodev-1.7.ebuild,v
retrieving revision 1.1
diff -u -B -u -r1.1 cryptodev-1.7.ebuild
--- cryptodev-1.7.ebuild        11 Apr 2015 12:12:04 -0000      1.1
+++ cryptodev-1.7.ebuild        24 Apr 2015 21:33:42 -0000
@@ -36,6 +36,7 @@
                die "cryptodev ebuild only support linux"
        fi
        BUILD_TARGETS="build"
+       export KERNEL_DIR
 }
 
 src_prepare() {
Comment 8 Toralf Förster gentoo-dev 2015-04-24 21:50:05 UTC
Bingo!
issue went away
Comment 9 Markos Chandras (RETIRED) gentoo-dev 2015-04-24 21:53:56 UTC
(In reply to Toralf Förster from comment #8)
> Bingo!
> issue went away

awesome thanks for testing

+  24 Apr 2015; Markos Chandras <hwoarang@gentoo.org> cryptodev-1.7.ebuild:
+  export KERNEL_DIR to prevent the Makefile from trying to detect the kernel
+  source itself which might break chroots and containers. Bug #547028. Thanks to
+  Toralf Förster for the report and testing
+
Comment 10 Toralf Förster gentoo-dev 2015-04-25 09:36:52 UTC
FWIW

$> find . -name '*.ebuild' | xargs grep -Hl uname | xargs dirname | sort -u 

lists about 2 dozen packages