Until this commit the mainline kernel version (this version) of the vboxguest module contained a bug where it defined VBGL_IOCTL_VMMDEV_REQUEST_BIG and VBGL_IOCTL_LOG using _IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead of _IO(V, ...) as the out of tree VirtualBox upstream version does. Since the VirtualBox userspace bits are always built against VirtualBox upstream's headers, this means that so far the mainline kernel version of the vboxguest module has been failing these 2 ioctls with -ENOTTY. I guess that VBGL_IOCTL_VMMDEV_REQUEST_BIG is never used causing us to not hit that one and sofar the vboxguest driver has failed to actually log any log messages passed it through VBGL_IOCTL_LOG. This commit changes the VBGL_IOCTL_VMMDEV_REQUEST_BIG and VBGL_IOCTL_LOG defines to match the out of tree VirtualBox upstream vboxguest version, while keeping compatibility with the old wrong request defines so as to not break the kernel ABI in case someone has been using the old request defines.
Unified · Split
| @@ -1520,7 +1520,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) · 1519 unmodified lines | |||
| 1520 | 1520 | ||
| 1521 | /* For VMMDEV_REQUEST hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT */ | 1521 | /* For VMMDEV_REQUEST hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT */ |
| 1522 | if (req_no_size == VBG_IOCTL_VMMDEV_REQUEST(0) || | 1522 | if (req_no_size == VBG_IOCTL_VMMDEV_REQUEST(0) || |
| 1523 | req == VBG_IOCTL_VMMDEV_REQUEST_BIG) | 1523 | req == VBG_IOCTL_VMMDEV_REQUEST_BIG || |
| 1524 | req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT) | ||
| 1524 | return vbg_ioctl_vmmrequest(gdev, session, data); | 1525 | return vbg_ioctl_vmmrequest(gdev, session, data); |
| 1525 | 1526 | ||
| 1526 | if (hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT) | 1527 | if (hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT) |
| @@ -1558,6 +1559,7 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) · 31 unmodified lines | |||
| 1558 | case VBG_IOCTL_HGCM_CALL(0): | 1559 | case VBG_IOCTL_HGCM_CALL(0): |
| 1559 | return vbg_ioctl_hgcm_call(gdev, session, f32bit, data); | 1560 | return vbg_ioctl_hgcm_call(gdev, session, f32bit, data); |
| 1560 | case VBG_IOCTL_LOG(0): | 1561 | case VBG_IOCTL_LOG(0): |
| 1562 | case VBG_IOCTL_LOG_ALT(0): | ||
| 1561 | return vbg_ioctl_log(data); | 1563 | return vbg_ioctl_log(data); |
| 1562 | } | 1564 | } |
| 1563 | 1565 | ||
| @@ -15,6 +15,21 @@ · 14 unmodified lines | |||
| 15 | #include <linux/vboxguest.h> | 15 | #include <linux/vboxguest.h> |
| 16 | #include "vmmdev.h" | 16 | #include "vmmdev.h" |
| 17 | 17 | ||
| 18 | /* | ||
| 19 | * The mainline kernel version (this version) of the vboxguest module | ||
| 20 | * contained a bug where it defined VBGL_IOCTL_VMMDEV_REQUEST_BIG and | ||
| 21 | * VBGL_IOCTL_LOG using _IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead | ||
| 22 | * of _IO(V, ...) as the out of tree VirtualBox upstream version does. | ||
| 23 | * | ||
| 24 | * These _ALT definitions keep compatibility with the wrong defines the | ||
| 25 | * mainline kernel version used for a while. | ||
| 26 | * Note the VirtualBox userspace bits have always been built against | ||
| 27 | * VirtualBox upstream's headers, so this is likely not necessary. But | ||
| 28 | * we must never break our ABI so we keep these around to be 100% sure. | ||
| 29 | */ | ||
| 30 | #define VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) | ||
| 31 | #define VBG_IOCTL_LOG_ALT(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) | ||
| 32 | |||
| 18 | struct vbg_session; | 33 | struct vbg_session; |
| 19 | 34 | ||
| 20 | /** VBox guest memory balloon. */ | 35 | /** VBox guest memory balloon. */ |
| @@ -131,7 +131,8 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req, · 130 unmodified lines | |||
| 131 | * the need for a bounce-buffer and another copy later on. | 131 | * the need for a bounce-buffer and another copy later on. |
| 132 | */ | 132 | */ |
| 133 | is_vmmdev_req = (req & ~IOCSIZE_MASK) == VBG_IOCTL_VMMDEV_REQUEST(0) || | 133 | is_vmmdev_req = (req & ~IOCSIZE_MASK) == VBG_IOCTL_VMMDEV_REQUEST(0) || |
| 134 | req == VBG_IOCTL_VMMDEV_REQUEST_BIG; | 134 | req == VBG_IOCTL_VMMDEV_REQUEST_BIG || |
| 135 | req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT; | ||
| 135 | 136 | ||
| 136 | if (is_vmmdev_req) | 137 | if (is_vmmdev_req) |
| 137 | buf = vbg_req_alloc(size, VBG_IOCTL_HDR_TYPE_DEFAULT, | 138 | buf = vbg_req_alloc(size, VBG_IOCTL_HDR_TYPE_DEFAULT, |
| @@ -103,7 +103,7 @@ VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); · 102 unmodified lines | |||
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | /* IOCTL to perform a VMM Device request larger then 1KB. */ | 105 | /* IOCTL to perform a VMM Device request larger then 1KB. */ |
| 106 | #define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) | 106 | #define VBG_IOCTL_VMMDEV_REQUEST_BIG _IO('V', 3) |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | /** VBG_IOCTL_HGCM_CONNECT data structure. */ | 109 | /** VBG_IOCTL_HGCM_CONNECT data structure. */ |
| @@ -198,7 +198,7 @@ struct vbg_ioctl_log { · 88 unmodified lines | |||
| 198 | } u; | 198 | } u; |
| 199 | }; | 199 | }; |
| 200 | 200 | ||
| 201 | #define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) | 201 | #define VBG_IOCTL_LOG(s) _IO('V', 9) |
| 202 | 202 | ||
| 203 | 203 | ||
| 204 | /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ | 204 | /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ |