[vbox-dev] FTBS when linking with -pie for ASLR support

Moez Roy moez.roy at gmail.com
Wed May 27 20:35:32 GMT 2015


Hello,

I am trying to build VirtualBox with ASLR support so it passes the
checksec test.

I did:

sed -i 's/-fPIC/-fPIC -pie/' Config.kmk




However this causes the build to fail:

kmk: *** [/VirtualBox-5.0.0_BETA4/out/linux.amd64/release/obj/VBoxRTImp/VBoxRTImp.so]
Error 1
The failing command:
@g++ -shared               '-Wl,-rpath,/opt/VirtualBox' -fPIC -pie
-Wl,-z,noexecstack,-z,relro -Wl,--as-needed -m64   -o
/VirtualBox-5.0.0_BETA4/out/linux.amd64/release/obj/VBoxRTImp/VBoxRTImp.so
-Wl,-soname=VBoxRT.so
/VirtualBox-5.0.0_BETA4/out/linux.amd64/release/obj/VBoxRTImp/gen/VBoxRTImpImp.o
    -lpthread   -lm   -lrt   -ldl
/usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/Scrt1.o: In
function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
kmk: *** [/VirtualBox-5.0.0_BETA4/out/linux.amd64/release/obj/VMMR3Imp/VMMR3Imp.so]
Error 1
The failing command:
@g++ -shared               '-Wl,-rpath,/opt/VirtualBox' -fPIC -pie
-Wl,-z,noexecstack,-z,relro -Wl,--as-needed -m64   -o
/VirtualBox-5.0.0_BETA4/out/linux.amd64/release/obj/VMMR3Imp/VMMR3Imp.so
-Wl,-soname=VBoxVMM.so
/VirtualBox-5.0.0_BETA4/out/linux.amd64/release/obj/VMMR3Imp/gen/VMMR3ImpImp.o
    -lpthread   -lm   -lrt   -ldl
kmk: *** Exiting with status 2





PS. I have managed to get VirtualBox to build with -Wl,-z,now (FULL
RELRO) but I cannot enable PIE on VBoxSVC and VBoxXPCOMIPCD:

checksec --proc-all

VBoxXPCOMIPCD  19080 Full RELRO        No canary found        NX
enabled    No PIE
         VBoxSVC  19087 Full RELRO        Canary found           NX
enabled    No PIE

Any help in getting VirtualBox to build with ASLR support appreciated.


Thanks.

-Moez




More information about the vbox-dev mailing list