• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscapheguic翻訳omegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

external/gbm_gralloc


Commit MetaInfo

Revisiond8b95e3ed2f0b38949c9339b6f5c9ffb32ca1089 (tree)
Zeit2017-10-05 02:54:07
AutorChih-Wei Huang <cwhuang@linu...>
CommiterRob Herring

Log Message

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.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>

Ändern Zusammenfassung

Diff

--- a/gralloc_drm_handle.h
+++ b/gralloc_drm_handle.h
@@ -49,9 +49,9 @@ struct gralloc_drm_handle_t {
4949
5050 int name; /* the name of the bo */
5151 int stride; /* the stride in bytes */
52- uint64_t modifier; /* buffer modifiers */
53-
5452 int data_owner; /* owner of data (for validation) */
53+
54+ uint64_t modifier __attribute__((aligned(8))); /* buffer modifiers */
5555 union {
5656 void *data; /* pointer to struct gralloc_gbm_bo_t */
5757 uint64_t reserved;