From 642eae84652170e0eed47c5eebe2f9894e6c37da Mon Sep 17 00:00:00 2001 From: Sune Vuorela Date: Wed, 9 Jul 2008 00:21:00 +0000 Subject: Fix some unaligned access issues that makes any webkit using application crash (SIGBUS) on archs where this isn't allowed. Patch by Mike Hommey. See #487745 for details. --- debian/changelog | 3 + debian/patches/30_webkit-unaligned-access.patch | 152 ++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 156 insertions(+) create mode 100644 debian/patches/30_webkit-unaligned-access.patch (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 70a9b58..6d3b896 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ qt4-x11 (4.4.0-4~pre1) unstable; urgency=low * Get patch from 4.4.2 (yes!) to fix painting of scrollbars in webkit with some styles. * Get patch from 4.4.2 to allow Https to be treated as https in -network. + * Fix some unaligned access issues that makes any webkit using application + crash (SIGBUS) on archs where this isn't allowed. Patch by Mike Hommey. + See #487745 for details. +++ Changes by Modestas Vainius: diff --git a/debian/patches/30_webkit-unaligned-access.patch b/debian/patches/30_webkit-unaligned-access.patch new file mode 100644 index 0000000..5bec884 --- /dev/null +++ b/debian/patches/30_webkit-unaligned-access.patch @@ -0,0 +1,152 @@ +From: Mike Hommey +Date: Sun, 6 Jul 2008 08:37:28 +0000 (+0200) +Subject: Fixed some alignment problems on sparc +X-Git-Tag: debian/1.0.1-1~7 +X-Git-Url: http://git.debian.org/?p=pkg-webkit%2Fwebkit.git;a=commitdiff_plain;h=11c220f6d31898a7a1dfafd5d96619fefe6ba597;hp=1db04c3a5c8c3e9c990b93836d5bb09d43a47921 + +Fixed some alignment problems on sparc + +(and some that might occur on arm, too). + +Some compiler warnings about alignment remain, but I don't know if they are +a real problem yet. +--- + +Index: b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp +=================================================================== +--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp ++++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp +@@ -1267,14 +1267,14 @@ + + // Page-level allocator + static SpinLock pageheap_lock = SPINLOCK_INITIALIZER; +-static void* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(void*) - 1) / sizeof(void*)]; ++static uint64_t pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(uint64_t) - 1) / sizeof(uint64_t)]; + static bool phinited = false; + + // Avoid extra level of indirection by making "pageheap" be just an alias + // of pageheap_memory. + + typedef union { +- void* m_memory; ++ uint64_t* m_memory; + TCMalloc_PageHeap m_pageHeap; + } PageHeapUnion; + +Index: b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h +=================================================================== +--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h ++++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h +@@ -122,7 +122,7 @@ + : m_freeList(pool()) + , m_isDoneWithInitialFreeList(false) + { +- memset(m_pool.pool, 0, sizeof(m_pool.pool)); ++ memset(m_pool, 0, sizeof(m_pool)); + } + + Node* allocate() +@@ -166,7 +166,7 @@ + } + + private: +- Node* pool() { return reinterpret_cast(m_pool.pool); } ++ Node* pool() { return reinterpret_cast(m_pool); } + Node* pastPool() { return pool() + m_poolSize; } + + bool inPool(Node* node) +@@ -177,10 +177,7 @@ + Node* m_freeList; + bool m_isDoneWithInitialFreeList; + static const size_t m_poolSize = 256; +- union { +- char pool[sizeof(Node) * m_poolSize]; +- double forAlignment; +- } m_pool; ++ uint32_t m_pool[(sizeof(Node) * m_poolSize + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; + }; + + template struct ListHashSetNode { +Index: b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +=================================================================== +--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h ++++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +@@ -167,6 +167,23 @@ + #define WTF_PLATFORM_X86_64 1 + #endif + ++/* PLATFORM(SPARC) */ ++#if defined(__sparc__) \ ++ || defined(__sparc) ++#define WTF_PLATFORM_SPARC 1 ++#define WTF_PLATFORM_BIG_ENDIAN 1 ++#endif ++ ++/* For undefined platforms */ ++#if !defined(WTF_PLATFORM_BIG_ENDIAN) && !defined(WTF_PLATFORM_MIDDLE_ENDIAN) ++#include ++#if __BYTE_ORDER == __BIG_ENDIAN ++#define WTF_PLATFORM_BIG_ENDIAN 1 ++#elif __BYTE_ORDER == __PDP_ENDIAN ++#define WTF_PLATFORM_MIDDLE_ENDIAN 1 ++#endif ++#endif ++ + /* Compiler */ + + /* COMPILER(MSVC) */ +Index: b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +=================================================================== +--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h ++++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +@@ -355,8 +355,7 @@ + static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T); + T* inlineBuffer() { return reinterpret_cast(&m_inlineBuffer); } + +- // FIXME: Nothing guarantees this buffer is appropriately aligned to hold objects of type T. +- char m_inlineBuffer[m_inlineBufferSize]; ++ uint64_t m_inlineBuffer[(m_inlineBufferSize + sizeof(uint64_t) - 1) / sizeof(uint64_t)]; + }; + + template +Index: b/src/3rdparty/webkit/WebCore/platform/AtomicString.cpp +=================================================================== +--- a/src/3rdparty/webkit/WebCore/platform/AtomicString.cpp ++++ b/src/3rdparty/webkit/WebCore/platform/AtomicString.cpp +@@ -104,7 +104,7 @@ + if (strLength != bufLength) + return false; + +-#if PLATFORM(ARM) ++#if PLATFORM(ARM) || PLATFORM(SPARC) + const UChar* strChars = str->characters(); + const UChar* bufChars = buf.s; + +Index: b/src/3rdparty/webkit/WebCore/platform/StringHash.h +=================================================================== +--- a/src/3rdparty/webkit/WebCore/platform/StringHash.h ++++ b/src/3rdparty/webkit/WebCore/platform/StringHash.h +@@ -44,6 +44,15 @@ + if (aLength != bLength) + return false; + ++#if PLATFORM(ARM) || PLATFORM(SPARC) ++ const UChar* aChars = a->characters(); ++ const UChar* bChars = b->characters(); ++ for (unsigned i = 0; i != aLength; ++i) ++ if (*aChars++ != *bChars++) ++ return false; ++ ++ return true; ++#else + const uint32_t* aChars = reinterpret_cast(a->characters()); + const uint32_t* bChars = reinterpret_cast(b->characters()); + +@@ -56,6 +65,7 @@ + return false; + + return true; ++#endif + } + }; + diff --git a/debian/patches/series b/debian/patches/series index 4c918ea..f4b2ec4 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -34,6 +34,7 @@ 15_fix_qmake_makefile_generation.diff 20_mips_atomic_ops.diff 21_qprintdialog_honour_fileprintersadded.diff +30_webkit-unaligned-access.patch 40_alpha_ice.diff 41_disable_opengl_visibility.diff 50_kfreebsd_build_fix.diff -- cgit v1.2.3