# open-vm-tools-kmod on hardened profile

## zaanpenguin

Has anyone been able to compile the open VMWare tools kernel modules on a hardened profile? I've tried all 5 gcc profile options (no pie, no ssp, etc.) and it always fails on this error during building of the VMCI module:

```
 * Preparing vmci module

make -j5 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS= auto-build HEADER_DIR=/usr/src/linux/include BUILD_DIR=/lib/modules/3.0.4-hardened-r5/build OVT_SOURCE_DIR=/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295 

Using 2.6.x kernel build system.

make -C /lib/modules/3.0.4-hardened-r5/build SUBDIRS=$PWD SRCROOT=$PWD/. \

  MODULEBUILDDIR= modules

make[1]: Entering directory `/usr/src/linux-3.0.4-hardened-r5'

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.o

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/vmciKernelIf.o

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/common/vmciDatagram.o

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/common/vmciDriver.o

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/common/vmciResource.o

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/common/vmciResource.c:334:1: warning: ‘inline’ is not at beginning of declaration

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/common/vmciContext.o

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/common/vmciHashtable.o

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c: In function ‘vmci_host_init’:

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c:387:4: warning: passing argument 1 of ‘memset’ discards qualifiers from pointer target type

/usr/src/linux-3.0.4-hardened-r5/arch/x86/include/asm/string_64.h:55:7: note: expected ‘void *’ but argument is of type ‘const struct file_operations *’

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c:388:4: error: assignment of read-only variable ‘vmuser_fops’

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c:389:4: error: assignment of read-only variable ‘vmuser_fops’

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c:391:4: error: assignment of read-only variable ‘vmuser_fops’

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c:396:4: error: assignment of read-only variable ‘vmuser_fops’

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c:398:4: error: assignment of read-only variable ‘vmuser_fops’

/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.c:399:4: error: assignment of read-only variable ‘vmuser_fops’

  CC [M]  /var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/common/vmciEvent.o

make[2]: *** [/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci/linux/driver.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [_module_/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295/modules/linux/vmci] Error 2

make[1]: Leaving directory `/usr/src/linux-3.0.4-hardened-r5'

make: *** [vmci.ko] Error 2

emake failed

 * ERROR: app-emulation/open-vm-tools-kmod-0.0.20110821.471295 failed (compile phase):

 *   Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- LDFLAGS=   auto-build HEADER_DIR=/usr/src/linux/include BUILD_DIR=/lib/modules/3.0.4-hardened-r5/build OVT_SOURCE_DIR=/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295

 * 

 * Call stack:

 *     ebuild.sh, line   91:  Called src_compile

 *   environment, line 3487:  Called linux-mod_src_compile

 *   environment, line 2690:  Called die

 * The specific snippet of code:

 *               eval "emake HOSTCC=\"$(tc-getBUILD_CC)\"                                               CROSS_COMPILE=${CHOST}-                                              LDFLAGS=\"$(get_abi_LDFLAGS)\"                                          ${BUILD_FIXES}                                               ${BUILD_PARAMS}                                                 ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";

 * 

 * If you need support, post the output of 'emerge --info =app-emulation/open-vm-tools-kmod-0.0.20110821.471295',

 * the complete build log and the output of 'emerge -pqv =app-emulation/open-vm-tools-kmod-0.0.20110821.471295'.

 * The complete build log is located at '/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/temp/environment'.

 * S: '/var/tmp/portage/app-emulation/open-vm-tools-kmod-0.0.20110821.471295/work/open-vm-tools-2011.08.21-471295'
```

Tweaking the USE flags to -pie/-pic doesn't help either.

----------

## leonidus

I came across the same problem. I filed a bug for it now: https://bugs.gentoo.org/show_bug.cgi?id=386721

----------

