[vbox-dev] Virtualbox is failing to build on linux 3.8.X with CONFIG_UIDGID_STRICT_TYPE_CHECKS=y

Nikita Kozlov nikita at elyzion.net
Mon Mar 4 17:52:39 GMT 2013


Hello*Alex Xu* ,

In reply to 
https://www.virtualbox.org/pipermail/vbox-dev/2012-December/005564.html.

If, in your kernel, you have enabled CONFIG_UIDGID_STRICT_TYPE_CHECKS 
(in General Setup section, which is selected by default if you have 
enabled the new user namespaces feature),
virtualbox kernel modules won't build and you will have errors like :

.../vboxdrv/linux/SUPDrv-linux.c: In function 'vboxdrvLinuxUid':
.../vboxdrv/linux/SUPDrv-linux.c:226:5: error: incompatible types when returning type 'kuid_t' but 'RTUID' was expected
...


It's because when that option is enabled in the kernel, kuid_t and 
kgui_t are defined as structs instead of just uid_t (which is a 
uint32_t) and the build is broken in that case.
(https://github.com/mirrors/linux/blob/master/include/linux/uidgid.h)

I guess that to fix it cleanly, you will have to , in 
vbox-kernel-module-src in RT_OS_LINUX case, :
- patch iptr/types.h to include linux/uidgid.h
- define RTUID/RTGID as kuid_t/kgid_t
- define NIL_RTUID as KUIDT_INIT(0) (a define from uidgid.h)
- check that on variables of type RTUID/RTGID you don't use direct 
arthmetic operations or comparison with int or uint (but I guess it's 
already the case).
- maybe more things

Another (less?) clean fix could be to add a .val in SUPDrv-linux.c lines 
226,235,244 (and maybe somewhere else too) when the kernel was build 
with CONFIG_UIDGID_STRICT_TYPE_CHECKS=y.

In your case, I guess you don't want to patch virtualbox source code, 
you could just disable CONFIG_UIDGID_STRICT_TYPE_CHECKS (and, 
unfortunately, everything depending on it), it will resolve your issue.

Regards,

Nikita




More information about the vbox-dev mailing list