Bug 12841 - Crash on ARM due to mis-alignment
Summary: Crash on ARM due to mis-alignment
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 420+
Hardware: Other Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-21 04:29 PST by Oscar Cwajbaum
Modified: 2007-02-22 08:11 PST (History)
1 user (show)

See Also:


Attachments
Fix ARM crash due to mis-alignment (1.47 KB, patch)
2007-02-21 04:30 PST, Oscar Cwajbaum
no flags Details | Formatted Diff | Diff
Fix ARM crash due to mis-alignment - rev2 (1.17 KB, patch)
2007-02-22 00:48 PST, Oscar Cwajbaum
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oscar Cwajbaum 2007-02-21 04:29:36 PST
ARM has stricter alignment rules than many other architectures. In this case, pageheap_memory is being declared as a char array, so it is not aligned by the compiler. It is later used as TCMalloc_PageHeap*, which does require alignment.

When building under ARM, this patch tells the compiler to stricly align pageheap_memory so that pageheap_memory can be used as TCMalloc_PageHeap*. It does not affect other platforms.
Comment 1 Oscar Cwajbaum 2007-02-21 04:30:54 PST
Created attachment 13292 [details]
Fix ARM crash due to mis-alignment
Comment 2 Darin Adler 2007-02-21 17:21:09 PST
Comment on attachment 13292 [details]
Fix ARM crash due to mis-alignment

I think there's a more-portable way to solve this problem. We could make pageheap_memory be an array of pointers instead of an array of char. That would ive us the alignment we need to store pointers in it.

static void* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(void*) - 1) / sizeof(void*)];

What do you think?
Comment 3 Maciej Stachowiak 2007-02-22 00:15:30 PST
I agree with Darin. I think it is better to enforce the alignment in a portable way, by making the array be a pointer array or the like.
Comment 4 Oscar Cwajbaum 2007-02-22 00:48:00 PST
Created attachment 13312 [details]
Fix ARM crash due to mis-alignment - rev2
Comment 5 Oscar Cwajbaum 2007-02-22 00:50:34 PST
Sounds good to me. I've attached a modified patch with Darin's suggestion.

Comment 6 Maciej Stachowiak 2007-02-22 02:26:04 PST
Comment on attachment 13312 [details]
Fix ARM crash due to mis-alignment - rev2

r=me
Comment 7 Sam Weinig 2007-02-22 08:11:01 PST
Landed in r19791.