mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
staging: android: binder: fix alignment issues
The Android userspace aligns the data written to the binder buffers to
4bytes. Thus for 32bit platforms or 64bit platforms running an 32bit
Android userspace we can have a buffer looking like this:
platform buffer(binder_cmd pointer) size
32/32 32b 32b 8B
64/32 32b 64b 12B
64/64 32b 64b 12B
Thus the kernel needs to check that the buffer size is aligned to 4bytes
not to (void *) that will be 8bytes on 64bit machines.
The change does not affect existing 32bit ABI.
Change-Id: Idcad35da1c1567ee0676d60d03afd07b219c59ea
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: ec35e852dc
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
This commit is contained in:
parent
db4620e641
commit
502645dba8
1 changed files with 2 additions and 2 deletions
|
@ -1340,7 +1340,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
|
|||
struct flat_binder_object *fp;
|
||||
if (*offp > buffer->data_size - sizeof(*fp) ||
|
||||
buffer->data_size < sizeof(*fp) ||
|
||||
!IS_ALIGNED(*offp, sizeof(void *))) {
|
||||
!IS_ALIGNED(*offp, sizeof(u32))) {
|
||||
pr_err("transaction release %d bad offset %zd, size %zd\n",
|
||||
debug_id, *offp, buffer->data_size);
|
||||
continue;
|
||||
|
@ -1594,7 +1594,7 @@ static void binder_transaction(struct binder_proc *proc,
|
|||
struct flat_binder_object *fp;
|
||||
if (*offp > t->buffer->data_size - sizeof(*fp) ||
|
||||
t->buffer->data_size < sizeof(*fp) ||
|
||||
!IS_ALIGNED(*offp, sizeof(void *))) {
|
||||
!IS_ALIGNED(*offp, sizeof(u32))) {
|
||||
binder_user_error("%d:%d got transaction with invalid offset, %zd\n",
|
||||
proc->pid, thread->pid, *offp);
|
||||
return_error = BR_FAILED_REPLY;
|
||||
|
|
Loading…
Reference in a new issue