True both for the stable gcc 4.3.4 and for unstable gcc 4.4.4-r2 in hardened Gentoo (x86, didn't test on amd64). Perhaps SSP/PIE should be turned off in the ebuild. Builds fine on non-hardened x86/amd64. CHOST="i686-pc-linux-gnu" CFLAGS="-Os -march=i686 -mtune=core2 -fomit-frame-pointer -pipe" >>> Failed to emerge app-emulation/virt-what-1.2, Log file: >>> '/var/tmp/portage/app-emulation/virt-what-1.2/temp/build.log' * CPV: app-emulation/virt-what-1.2 * REPO: gentoo * USE: elibc_glibc kernel_linux userland_GNU x86 * Applying virt-what-1.2-bin-to-sbin.patch ... [ ok ] * Applying virt-what-1.2-vmware-cpuid-check.patch ... [ ok ] * Running eautoreconf in '/var/tmp/portage/app-emulation/virt-what-1.2/work/virt-what-1.2' ... * Running aclocal ... [ ok ] * Running autoconf ... [ ok ] * Running autoheader ... [ ok ] * Running automake --add-missing --copy --foreign ... [ ok ] checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking for i686-pc-linux-gnu-gcc... i686-pc-linux-gnu-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether i686-pc-linux-gnu-gcc accepts -g... yes checking for i686-pc-linux-gnu-gcc option to accept ISO C89... none needed checking dependency style of i686-pc-linux-gnu-gcc... gcc3 checking for i686-pc-linux-gnu-gcc option to accept ISO C99... -std=gnu99 checking for i686-pc-linux-gnu-gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99 checking how to run the C preprocessor... i686-pc-linux-gnu-gcc -std=gnu99 -E checking for function prototypes... yes checking whether i686-pc-linux-gnu-gcc -std=gnu99 and cc understand -c and -o together... yes configure: creating ./config.status config.status: creating virt-what config.status: creating Makefile config.status: creating config.h config.status: executing depfiles commands make all-am make[1]: Entering directory `/var/tmp/portage/app-emulation/virt-what-1.2/work/virt-what-1.2' i686-pc-linux-gnu-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -Wall -Os -march=i686 -mtune=core2 -fomit-frame-pointer -pipe -MT virt-what-cpuid-helper.o -MD -MP -MF .deps/virt-what-cpuid-helper.Tpo -c -o virt-what-cpuid-helper.o virt-what-cpuid-helper.c pod2man -c "Virtualization Support" --release "virt-what-1.2" \ virt-what.pod > virt-what.1 virt-what-cpuid-helper.c: In function ‘cpu_sig’: virt-what-cpuid-helper.c:32: error: can't find a register in class ‘BREG’ while reloading ‘asm’ virt-what-cpuid-helper.c:32: error: ‘asm’ operand has impossible constraints make[1]: *** [virt-what-cpuid-helper.o] Error 1 make[1]: *** Waiting for unfinished jobs.... virt-what.pod:1: Unknown command paragraph "=encoding utf8" make[1]: Leaving directory `/var/tmp/portage/app-emulation/virt-what-1.2/work/virt-what-1.2' make: *** [all] Error 2 * ERROR: app-emulation/virt-what-1.2 failed: * emake failed * * Call stack: * ebuild.sh, line 54: Called src_compile * environment, line 2797: Called _eapi2_src_compile * ebuild.sh, line 646: Called die * The specific snippet of code: * emake || die "emake failed" * * If you need support, post the output of 'emerge --info =app-emulation/virt-what-1.2', * the complete build log and the output of 'emerge -pqv =app-emulation/virt-what-1.2'. * The complete build log is located at '/var/tmp/portage/app-emulation/virt-what-1.2/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/app-emulation/virt-what-1.2/temp/environment'. * S: '/var/tmp/portage/app-emulation/virt-what-1.2/work/virt-what-1.2'
Apparently, same issue as with bug 362167 - same ways to fix, too.
* Messages for package app-emulation/virt-what-1.2: * Package: app-emulation/virt-what-1.2 * Repository: gentoo * Maintainer: cardoe@gentoo.org * USE: amd64 elibc_glibc kernel_linux userland_GNU * FEATURES: fakeroot preserve-libs sandbox suidctl usersandbox * Package: app-emulation/virt-what-1.2 * Repository: gentoo * Maintainer: cardoe@gentoo.org * USE: amd64 elibc_glibc kernel_linux userland_GNU * FEATURES: fakeroot preserve-libs sandbox suidctl usersandbox * Applying virt-what-1.2-bin-to-sbin.patch ... * Applying virt-what-1.2-vmware-cpuid-check.patch ... * Running eautoreconf in '/var/tmp/portage/app-emulation/virt-what-1.2/work/virt-what-1.2' ... * Running aclocal ... * Running autoconf ... * Running autoheader ... * Running automake --add-missing --copy --foreign ... p.s. % eix virt-what [I] app-emulation/virt-what Available versions: (~)1.0[1] (~)1.2{tbz2} Installed versions: 1.2{tbz2}(00:28:25 06.04.2011) Homepage: http://people.redhat.com/~rjones/virt-what/ Description: Detects if the current machine is running in a virtual machine p.p.s. Portage 2.2.0_alpha29 (hardened/linux/amd64/no-multilib, gcc-4.5.2, glibc-2.13-r2, 2.6.38-hardened x86_64)
Portage 2.1.9.42 (hardened/linux/x86, gcc-4.4.5, glibc-2.11.3-r0, 2.6.32-gentoo-r7 i686) ================================================================= System Settings ================================================================= Timestamp of tree: Tue, 05 Apr 2011 00:45:01 +0000 app-shells/bash: 4.1_p9 dev-lang/python: 2.6.6-r2 dev-util/cmake: 2.8.1-r2 sys-apps/baselayout: 1.12.14-r1 sys-apps/sandbox: 2.4 sys-devel/autoconf: 2.65-r1 sys-devel/automake: 1.10.3, 1.11.1 sys-devel/binutils: 2.20.1-r1 sys-devel/gcc: 4.4.5 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.10 sys-devel/make: 3.81-r2 virtual/os-headers: 2.6.36.1 (sys-kernel/linux-headers) ACCEPT_KEYWORDS="x86" CBUILD="i686-pc-linux-gnu" CFLAGS="-Os -march=i686 -mtune=core2 -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CXXFLAGS="-Os -march=i686 -mtune=core2 -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs collision-protect distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="" LDFLAGS="-Wl,--as-needed"
The bug persists in gcc-4.5.3-r1 and virt-what-1.11.
Does cpuid actually clobber %ebx? I'll have to have a look at the Intel PRM later on.
(In reply to comment #5) > Does cpuid actually clobber %ebx? Yes, for nearly all parameters. https://en.wikipedia.org/wiki/CPUID
Upstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=804282
Created attachment 305683 [details, diff] 0001-Preserve-ebx-across-CPUID-when-using-PIE-thanks-Faus.patch I'd be greatful if someone on Gentoo could try the attached patch, both that it fixes the compiler error, and (more importantly) that virt-what still works afterwards.
The patch looks sane (tries to shield ebx on pie system) and it works on my kvm i686 guest as well as non-hardened. hard-thirtytwo virt-what # virt-what kvm @cardoe. Its probably safe to apply this patch unconditionally, but if you want, you can apply condition on use hardened.
It also compiles fine here, and I will test shortly in QEMU w/ and w/o KVM, and VMware.
Seems to work fine, thanks!
> @cardoe. Its probably safe to apply this patch unconditionally, but if you > want, you can apply condition on use hardened. Actually Zorry pointed out that its really the pic flag we want on x86.
Thanks for testing. I'm going to push this patch upstream shortly, and make a new version of virt-what (1.12) which contains the fix.
New version is here: http://people.redhat.com/~rjones/virt-what/files/
Hi, is it possible to add the fixed virt-what-1.12 to the tree? Bump request is #409237 (filed 4 months ago).
New version is now in tree.