Skip to contentSkip to conversation

Patch "drm: Pad drm_mode_get_connector to 64-bit boundary" has been added to staging queue

3.5.y.z extended stable Luis Henriques 1 participant 1 message Nov 6, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This is a note to let you know that I have just added a patch titled

drm: Pad drm_mode_get_connector to 64-bit boundary

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at:

http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please reply to this email.

For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

Quoted 1 line

From 81019eb6f5b7e60b588128f63e0bfaf34b650bcf Mon Sep 17 00:00:00 2001

From: Chris Wilson <[email protected]>
Date: Wed, 16 Oct 2013 09:49:02 +0100
Subject: drm: Pad drm_mode_get_connector to 64-bit boundary

commit bc5bd37ce48c66e9192ad2e7231e9678880f6f8e upstream.

Pavel Roskin reported that DRM_IOCTL_MODE_GETCONNECTOR was overwritting the 4 bytes beyond the end of its structure with a 32-bit userspace running on a 64-bit kernel. This is due to the padding gcc inserts as the drm_mode_get_connector struct includes a u64 and its size is not a natural multiple of u64s.

64-bit kernel:

sizeof(drm_mode_get_connector)=80, alignof=8
sizeof(drm_mode_get_encoder)=20, alignof=4
sizeof(drm_mode_modeinfo)=68, alignof=4

32-bit userspace:

sizeof(drm_mode_get_connector)=76, alignof=4
sizeof(drm_mode_get_encoder)=20, alignof=4
sizeof(drm_mode_modeinfo)=68, alignof=4

Fortuituously we can insert explicit padding to the tail of our structures without breaking ABI.

[ luis: backported to 3.5:
- file rename: include/uapi/drm/drm_mode.h -> include/drm/drm_mode.h ]

---
 include/drm/drm_mode.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/drm_mode.h +2 -0
index 3d6301b..f604a1a 100644
@@ -223,6 +223,8 @@ struct drm_mode_get_connector {
 	__u32 connection;
 	__u32 mm_width, mm_height; /**< HxW in millimeters */
 	__u32 subpixel;
+
+	__u32 pad;
 };
 
 #define DRM_MODE_PROP_PENDING	(1<<0)

--
1.8.3.2