diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-10-16 04:49:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-12 22:05:34 -0500 |
commit | 9c1aab0da00ed04f096fabc4136241cb45f92cc1 (patch) | |
tree | a4dcc2bc23dd31c06430bbed8930d127882cc034 /include/uapi | |
parent | 45da934f7431181cd1ccc33b4d138dc41c2cd1ba (diff) |
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.
Reported-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/uapi')
-rw-r--r-- | include/uapi/drm/drm_mode.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 090e5331ab7e..cc2e00eac2f1 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h | |||
@@ -223,6 +223,8 @@ struct drm_mode_get_connector { | |||
223 | __u32 connection; | 223 | __u32 connection; |
224 | __u32 mm_width, mm_height; /**< HxW in millimeters */ | 224 | __u32 mm_width, mm_height; /**< HxW in millimeters */ |
225 | __u32 subpixel; | 225 | __u32 subpixel; |
226 | |||
227 | __u32 pad; | ||
226 | }; | 228 | }; |
227 | 229 | ||
228 | #define DRM_MODE_PROP_PENDING (1<<0) | 230 | #define DRM_MODE_PROP_PENDING (1<<0) |