Skip to content

Commit bc5bd37

Browse files
ickleairlied
authored andcommitted
drm: Pad drm_mode_get_connector to 64-bit boundary
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. Reported-by: Pavel Roskin <[email protected]> Signed-off-by: Chris Wilson <[email protected]> Cc: Dave Airlie <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]>
1 parent b062672 commit bc5bd37

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/uapi/drm/drm_mode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ struct drm_mode_get_connector {
223223
__u32 connection;
224224
__u32 mm_width, mm_height; /**< HxW in millimeters */
225225
__u32 subpixel;
226+
227+
__u32 pad;
226228
};
227229

228230
#define DRM_MODE_PROP_PENDING (1<<0)

0 commit comments

Comments
 (0)