Skip to content
Unverified Commit 597725e9 authored by Mauro Rossi's avatar Mauro Rossi Committed by Robert Foss
Browse files

android: Fix 32-bit app crashing in 64-bit Android



Seemingly the 64-bit int is always aligned to 8 in LP64.
But this is not hold in LP32.

Consequently sizeof(gralloc_drm_handle_t) are different
between LP64 (which is 18 ints) and LP32 (which is 16 ints).
As a result, 32-bit apps will crash in 64-bit OS since the
checking handle->base.numInts != GRALLOC_GBM_HANDLE_NUM_INTS
is true.

Fix it by always aligning 64-bit int to 8. Besides, to avoid
additional padding, just exchange the order of data_owner
and modifier. It aligns modifier to 8 natually.
This makes gralloc_drm_handle_t fit in 16 ints perfectly.

(v2) gralloc_drm_handle.h patch now applied in gralloc_handle.h
     and GRALLOC_HANDLE_VERSION updated to 4

Reported-by: default avatarMauro Rossi <issor.oruam@gmail.com>
Signed-off-by: default avatarChih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: default avatarRobert Foss <robert.foss@collabora.com>
parent 2c02f1e6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment