| Summary: | dkms-vboxadditions fails to build on startup for 3.3 kernel | ||
|---|---|---|---|
| Product: | Mageia | Reporter: | William Murphy <warrendiogenese> |
| Component: | RPM Packages | Assignee: | Thomas Backlund <tmb> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Normal | CC: | anaselli, ennael1, luca.pedrielli, pmdenielou |
| Version: | Cauldron | ||
| Target Milestone: | --- | ||
| Hardware: | i586 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Source RPM: | dkms-vboxadditions and kernel-desktop-3.3.0-0.rc6.1 | CVE: | |
| Status comment: | |||
|
Description
William Murphy
2012-03-07 15:25:25 CET
I confirm the bug within my vbox as well. CC:
(none) =>
malo FYI: vboxadditions will not compile on x86_64 install using vendor vbox package instead of Mageia packages for host and guest. I am using VirtualBox-4.1-4.1.8_75467_mdv2011.0-1.x86_64.rpm on a Cauldron host.
Anne Nicolas
2012-03-08 11:43:37 CET
CC:
(none) =>
ennael1
Manuel Hiebel
2012-03-08 12:22:49 CET
Assignee:
bugsquad =>
tmb If that is the problem can we have an update of virtual box in mga1? I seem i had this problem and now a kernel panic after updating. I can boot with 3.2.6-desktop-0.rc1.1.mga2 kernel instead. CC:
(none) =>
anaselli Forget my comment. i booted with an old kernel and installed again new one and old guest addition, now boots. Same problem with kernel-desktop-devel-3.3.0-0.rc7 CC:
(none) =>
luca.pedrielli It seems the drm_driver structure (used by vboxvideo) has been redefined in the 3.3 kernel.
the diff between the drmP.h (/include/drm) from kernel 3.2.9 (<) and 3.3.0.0.rc7 (>) is:
...
921c921
< struct file_operations fops;
---
> const struct file_operations *fops;
...
Apply this patch to vboxvideo_drm.c to fix it:
89,100d88
< #if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 3, 0)
< static struct file_operations hack_fops =
< {
< .owner = THIS_MODULE,
< .open = drm_open,
< .release = drm_release,
< .mmap = drm_mmap,
< .poll = drm_poll,
< .fasync = drm_fasync,
< };
< #endif
<
112,114d99
< #if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 3, 0)
< (const struct file_operations*) &hack_fops,
< #else
130d114
< #endif
Naming the structure 'hack_fops' might be a poor choice. :)
For clarity, the .fops structure has to refer a structure by constant pointer. The original code in vboxvideo_drm.c looks like:
...
static struct drm_driver driver =
{
/* .driver_features = DRIVER_USE_MTRR, */
.load = vboxvideo_driver_load,
.reclaim_buffers = drm_core_reclaim_buffers,
/* As of Linux 2.6.37, always the internal functions are used. */
#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 37) && !defined(DRM_RHEL61)
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
#endif
.fops =
{
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
/* This was changed with Linux 2.6.33 but Fedora backported this
* change to their 2.6.32 kernel. */
#if defined(DRM_UNLOCKED) || LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 33)
.unlocked_ioctl = drm_ioctl,
#else
.ioctl = drm_ioctl,
#endif
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
...
I altered it to look like this:
...
#if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 3, 0)
static struct file_operations hack_fops =
{
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
};
#endif
static struct drm_driver driver =
{
/* .driver_features = DRIVER_USE_MTRR, */
.load = vboxvideo_driver_load,
.reclaim_buffers = drm_core_reclaim_buffers,
/* As of Linux 2.6.37, always the internal functions are used. */
#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 37) && !defined(DRM_RHEL61)
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
#endif
.fops =
#if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 3, 0)
(const struct file_operations*) &hack_fops,
#else
{
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
/* This was changed with Linux 2.6.33 but Fedora backported this
* change to their 2.6.32 kernel. */
#if defined(DRM_UNLOCKED) || LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 33)
.unlocked_ioctl = drm_ioctl,
#else
.ioctl = drm_ioctl,
#endif
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
#endif
...
I hope that helps. It might need some cleaning up, but the modules compile.
I downloaded the src rpm and created a proper patch (finally) for virtualbox-4.1.8-3.mga2 The file_operations structure has been corrected. My vbox isn't set up for packaging (yet), so this hasn't been fully tested from build, but I manually build, installed and tested the modules before posting this patch: From 1830e1c8a67fe345838fadc9f4744f972914a38a Mon Sep 17 00:00:00 2001 From: diogenese <fcs@velotech.net> Date: Mon, 12 Mar 2012 08:23:59 -0700 Subject: [PATCH] * added kernel 3.3 support to drm_driver --- src/VBox/Additions/linux/drm/vboxvideo_drm.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.c b/src/VBox/Additions/linux/drm/vboxvideo_drm.c index b335f76..91bde06 100644 --- a/src/VBox/Additions/linux/drm/vboxvideo_drm.c +++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.c @@ -86,6 +86,18 @@ int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags) #endif } +#if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 3, 0) +static const struct file_operations hack_fops = +{ + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, +}; +#endif + static struct drm_driver driver = { /* .driver_features = DRIVER_USE_MTRR, */ @@ -97,6 +109,9 @@ static struct drm_driver driver = .get_reg_ofs = drm_core_get_reg_ofs, #endif .fops = +#if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 3, 0) + &hack_fops, +#else { .owner = THIS_MODULE, .open = drm_open, @@ -112,6 +127,7 @@ static struct drm_driver driver = .poll = drm_poll, .fasync = drm_fasync, }, +#endif #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 39) .pci_driver = { -- 1.7.4.4 a fixed virtualbox-4.1.8-4.mga2 is now available Status:
NEW =>
RESOLVED |