Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933105AbdIHNWh (ORCPT ); Fri, 8 Sep 2017 09:22:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36048 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933077AbdIHNWd (ORCPT ); Fri, 8 Sep 2017 09:22:33 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martijn Coenen Subject: [PATCH 4.12 06/43] ANDROID: binder: add padding to binder_fd_array_object. Date: Fri, 8 Sep 2017 15:18:54 +0200 Message-Id: <20170908131826.798740575@linuxfoundation.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170908131826.555428826@linuxfoundation.org> References: <20170908131826.555428826@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1362 Lines: 43 4.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martijn Coenen commit 5cdcf4c6a638591ec0e98c57404a19e7f9997567 upstream. binder_fd_array_object starts with a 4-byte header, followed by a few fields that are 8 bytes when ANDROID_BINDER_IPC_32BIT=N. This can cause alignment issues in a 64-bit kernel with a 32-bit userspace, as on x86_32 an 8-byte primitive may be aligned to a 4-byte address. Pad with a __u32 to fix this. Signed-off-by: Martijn Coenen Signed-off-by: Greg Kroah-Hartman --- include/uapi/linux/android/binder.h | 2 ++ 1 file changed, 2 insertions(+) --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -132,6 +132,7 @@ enum { /* struct binder_fd_array_object - object describing an array of fds in a buffer * @hdr: common header structure + * @pad: padding to ensure correct alignment * @num_fds: number of file descriptors in the buffer * @parent: index in offset array to buffer holding the fd array * @parent_offset: start offset of fd array in the buffer @@ -152,6 +153,7 @@ enum { */ struct binder_fd_array_object { struct binder_object_header hdr; + __u32 pad; binder_size_t num_fds; binder_size_t parent; binder_size_t parent_offset;