Had an issue with building/running wkhtmlpdf on Power Linux.
A segfault was reported to us... with a workaround identified
> > I've reproduced at least one SIGSEGV:
> >
> > #0 0x0000000010167a3c in .WTF::OSAllocator::reserveUncommitted(unsigned long, WTF::OSAllocator::Usage, bool, bool) ()
> > #1 0x000000001160e734 in .WTF::PageAllocationAligned::allocate(unsigned long, unsigned long, WTF::OSAllocator::Usage, bool, bool) ()
> > #2 0x000000001144b4fc in .JSC::MarkedBlock::create(JSC::JSGlobalData*, unsigned long) ()
> > #3 0x0000000010da9680 in .JSC::MarkedSpace::allocateBlock(JSC::MarkedSpace::SizeClass&) ()
> > #4 0x0000000010da9ac0 in .JSC::MarkedSpace::allocateFromSizeClass(JSC::MarkedSpace::SizeClass&) ()
> > #5 0x0000000010de71e8 in .JSC::JSGlobalData::JSGlobalData(JSC::JSGlobalData::GlobalDataType, JSC::ThreadStackType) ()
> > #6 0x0000000010de8cec in .JSC::JSGlobalData::createLeaked(JSC::ThreadStackType) ()
> > #7 0x0000000010197aec in .WebCore::JSDOMWindowBase::commonJSGlobalData() ()
> > #8 0x00000000101a320c in .WebCore::ScriptController::getAllWorlds(WTF::Vector<WebCore::DOMWrapperWorld*, 0ul>&) ()
> > #9 0x000000001053f2b8 in .WebCore::FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() ()
> > #10 0x0000000010540e24 in .WebCore::FrameLoader::receivedFirstData() ()
> > #11 0x0000000010537c40 in .WebCore::DocumentWriter::setEncoding(WTF::String const&, bool) ()
> > #12 0x000000001052fef4 in .WebCore::DocumentLoader::commitData(char const*, int)---Type <return> to continue, or q <return> to quit---
> > ()
> > #13 0x0000000010117650 in .WebCore::FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader*, char const*, int) ()
> > #14 0x0000000010530eb8 in .WebCore::DocumentLoader::commitLoad(char const*, int) ()
> > #15 0x00000000105645bc in .WebCore::MainResourceLoader::addData(char const*, int, bool) ()
> > #16 0x000000001057a9dc in .WebCore::ResourceLoader::didReceiveData(char const*, int, long long, bool) ()
> > #17 0x0000000010566ce4 in .WebCore::MainResourceLoader::didReceiveData(char const*, int, long long, bool) ()
> > #18 0x0000000010578364 in .WebCore::ResourceLoader::didReceiveData(WebCore::ResourceHandle*, char const*, int, int) ()
> > #19 0x000000001088e104 in .WebCore::QNetworkReplyHandler::forwardData() ()
> > #20 0x0000000010891210 in .WebCore::QNetworkReplyHandlerCallQueue::flush() [clone .part.47] ()
> > #21 0x0000000010892758 in .WebCore::QNetworkReplyWrapper::emitMetaDataChanged()
> > ()
> > #22 0x0000000010892c9c in .WebCore::QNetworkReplyWrapper::receiveMetaData() ()
> > #23 0x0000000010893364 in .WebCore::QNetworkReplyWrapper::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
> > #24 0x00000000122b6e0c in .QMetaObject::activate(QObject*, QMetaObject const*, int, void**) ()
> > ---Type <return> to continue, or q <return> to quit---
> > #25 0x000000001230f5cc in .QIODevice::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
> > #26 0x00000000122b20d4 in .QMetaCallEvent::placeMetaCall(QObject*) ()
> > #27 0x00000000122bbbd0 in .QObject::event(QEvent*) ()
> > #28 0x00000000118c1e78 in .QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
> > #29 0x00000000118cab4c in .QApplication::notify(QObject*, QEvent*) ()
> > #30 0x000000001229a180 in .QCoreApplication::notifyInternal(QObject*, QEvent*)
> > ()
> > #31 0x000000001229e97c in .QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
> > #32 0x00000000122d4dfc in .QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
> > #33 0x000000001229eef8 in .QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
> > #34 0x000000001006930c in .wkhtmltopdf::ConverterPrivate::convert() ()
> > #35 0x000000001004340c in .main ()
>
> It is an Qt issue that is doing an unsigned operations that might overflow. It
> uses system pagesize to make some calculation regarding a future mmap call to 'fix'
> alignment. However, since pagesize on powerpc64 is usually 64K, the operations overflows
> and the negative alignment adjustments ends up creating an wrong value that will be passed
> to mmap. More specifically, it is on:
>
> 54 size_t alignmentDelta = alignment - pageSize();
> 55
> 56 // Resererve with suffcient additional VM to correctly align.
> 57 size_t reservationSize = size + alignmentDelta;
> 58 void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable, executable);
>
> You can easily fix by:
>
> 53 size_t pagesize = pageSize();
> 54 size_t alignmentDelta = 0;
> 55 if (alignment > pagesize)
> 56 alignmentDelta = alignment - pagesize;
> 57
> 58 // Resererve with suffcient additional VM to correctly align.
> 59 size_t reservationSize = size + alignmentDelta;
> 60 void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable, executable);