Can not install on Debian

Discussions related to using VirtualBox on Linux hosts.
GerryS
Posts: 1
Joined: 22. Aug 2012, 03:06
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Linux

Re: Can not install on Debian

Post by GerryS »

Hello!

Virtualbox kernel module loading does not work here, too. I have the same kernel oops as reported by TJ on Debian Testing with a vanilla 3.5.2 kernel:

Code: Select all

localhost:~# cat /etc/debian_version
wheezy/sid
localhost:~# uname -a
Linux localhost 3.5.2 #1 SMP Wed Aug 15 21:19:06 CEST 2012 i686 GNU/Linux
localhost:~# gcc --version
gcc (Debian 4.7.1-2) 4.7.1
Latest VirtualBox package 4.1.20 installed with dpkg -i, no dkms:

Code: Select all

localhost:~# dpkg -i virtualbox-4.1_4.1.20-80170~Debian~wheezy_i386.deb
I've tracked the problem down to the definitions of RT_LIKELY & RT_UNLIKELY in /usr/share/virtualbox/src/vboxhost/vboxdrv/include/iprt/cdefs.h:

Code: Select all

#if defined(__GNUC__)
# if __GNUC__ >= 3 && !defined(FORTIFY_RUNNING)
#  define RT_LIKELY(expr)       __builtin_expect(!!(expr), 1)
#  define RT_UNLIKELY(expr)     __builtin_expect(!!(expr), 0)
# else
#  define RT_LIKELY(expr)       (expr)
#  define RT_UNLIKELY(expr)     (expr)
# endif
#else
# define RT_LIKELY(expr)        (expr)
# define RT_UNLIKELY(expr)      (expr)
#endif
The problem is caused if __builtin_expect() is used. If -DFORTIFY_RUNNING (-DLOG_ENABLED works too!) is added to the KFLAGS of the vboxdrv Makefile the module loads without problems!

Code: Select all

--- /usr/share/virtualbox/src/vboxhost/vboxdrv/Makefile.orig    2012-08-22 02:49:06.000000000 +0200
+++ /usr/share/virtualbox/src/vboxhost/vboxdrv/Makefile 2012-08-22 02:51:22.000000000 +0200
@@ -238,7 +238,7 @@
  MANGLING := $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h
 endif
 KFLAGS   := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \
-           -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING
+           -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DFORTIFY_RUNNING
 ifdef VBOX_REDHAT_KABI
  KFLAGS  += -DVBOX_REDHAT_KABI
 endif
gcc problem/bug?

Regards
Gerald
Marcel Veldhuizen
Posts: 3
Joined: 13. Oct 2012, 10:40

Re: Can not install on Debian

Post by Marcel Veldhuizen »

Sorry to bump an old thread, but Gerald's solution also helped me.

I'm running Debian wheezy with a 3.2.23 kernel (custom built). Neither the Debian package, nor the package by Oracle would install.
Added the -DFORTIFY_RUNNING and reran /etc/init.d/vboxdrv setup and now everything seems to be working. Thanks :)
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Re: Can not install on Debian

Post by frank »

TJ, it's a gcc bug! See here and here.
Post Reply