Bug 12841

Summary: Crash on ARM due to mis-alignment
Product: WebKit Reporter: Oscar Cwajbaum <public>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: kkowalczyk
Priority: P2    
Version: 420+   
Hardware: Other   
OS: Linux   
Attachments:
Description Flags
Fix ARM crash due to mis-alignment
none
Fix ARM crash due to mis-alignment - rev2 mjs: review+

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.