From patchwork Mon Nov 25 13:06:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 293924 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id F372B2C00B9 for ; Tue, 26 Nov 2013 00:08:18 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vkvtf-0006OK-88; Mon, 25 Nov 2013 13:08:15 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vkvsu-0005yN-Nz for kernel-team@lists.ubuntu.com; Mon, 25 Nov 2013 13:07:28 +0000 Received: from bl20-223-77.dsl.telepac.pt ([2.81.223.77] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Vkvsu-0003b5-EM; Mon, 25 Nov 2013 13:07:28 +0000 From: Luis Henriques To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Subject: [PATCH 3.5 14/78] drm: Pad drm_mode_get_connector to 64-bit boundary Date: Mon, 25 Nov 2013 13:06:01 +0000 Message-Id: <1385384825-21681-15-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1385384825-21681-1-git-send-email-luis.henriques@canonical.com> References: <1385384825-21681-1-git-send-email-luis.henriques@canonical.com> X-Extended-Stable: 3.5 Cc: Dave Airlie , dri-devel@lists.freedesktop.org, Chris Wilson X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com 3.5.7.26 -stable review patch. If anyone has any objections, please let me know. ------------------ From: Chris Wilson 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 Signed-off-by: Chris Wilson Cc: Dave Airlie Cc: dri-devel@lists.freedesktop.org Signed-off-by: Dave Airlie [ luis: backported to 3.5: - file rename: include/uapi/drm/drm_mode.h -> include/drm/drm_mode.h ] Signed-off-by: Luis Henriques --- include/drm/drm_mode.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 3d6301b..f604a1a 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h @@ -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)