public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martijn Coenen <maco@android.com>
To: gregkh@linuxfoundation.org, john.stultz@linaro.org,
	tkjos@google.com, arve@android.com, amit.pundir@linaro.org
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	maco@google.com, Martijn Coenen <maco@android.com>
Subject: [PATCH 1/3] ANDROID: binder: add padding to binder_fd_array_object.
Date: Fri, 28 Jul 2017 13:56:06 +0200	[thread overview]
Message-ID: <20170728115608.61306-2-maco@android.com> (raw)
In-Reply-To: <20170728115608.61306-1-maco@android.com>

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 <maco@android.com>
---
 include/uapi/linux/android/binder.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h
index 51f891fb1b18..7668b5791c91 100644
--- 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;
-- 
2.14.0.rc0.400.g1c36432dff-goog

  reply	other threads:[~2017-07-28 11:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 11:56 [PATCH 0/3] ANDROID: binder: reconcile with android common tree Martijn Coenen
2017-07-28 11:56 ` Martijn Coenen [this message]
2017-07-28 11:56 ` [PATCH 2/3] ANDROID: binder: add hwbinder,vndbinder to BINDER_DEVICES Martijn Coenen
2017-07-28 11:56 ` [PATCH 3/3] ANDROID: binder: fix proc->tsk check Martijn Coenen
2017-07-31  5:25   ` Amit Pundir
2017-08-08 17:34   ` John Stultz
2017-08-08 18:08     ` Greg KH
2017-08-08 18:24       ` John Stultz
2017-08-21 18:48       ` John Stultz
2017-08-22 15:49         ` Greg KH
2017-08-23  1:43           ` Greg KH
2017-07-28 23:22 ` [PATCH 0/3] ANDROID: binder: reconcile with android common tree Greg KH
2017-07-31  6:55   ` Martijn Coenen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170728115608.61306-2-maco@android.com \
    --to=maco@android.com \
    --cc=amit.pundir@linaro.org \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@google.com \
    --cc=tkjos@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox