On Sunday 25 May 2008, Sebastian Sauer wrote:

> raymond.meyer@rambler.ru wrote:

> > I can't start kde on netbsd sparc machine, because kdelibs contains code

> > that causes segfault. It terminates with "Bus error" which indicates

> > unaligned memory access. Below is the backtrace.

> >

> > The problem is with kdelibs-4.0.4/kdeui/icons/kpixmapcache.cpp. On line

> > 159 it has

> >

> > *mSize = *((quint32*)(mMemory + mSizeEntryOffset));

> >

> > So looks like a pointer to char is cast to a pointer to some form of

> > uint32_t and then dereferenced. Can anyone suggest a proper fix?

>

> iirc mMemory is the start of a buffer used to cache icons and at

> mMemory+mSizeEntryOffset is a 4byte quint32 that is used to know how much

> icons are within those buffer.

>

> https://bugs.kde.org/show_bug.cgi?id=160284

>

> workaround may to undef USE_MMAP, I also still seek for a proper fix :-(

I'll also attach this to bug 160284, but the attached patch may work (if that is the only thing causing unaligned accesses).

The patch works by adding padding between the header and the start of the data (what mSizeEntryOffset is supposed to be pointing to). I assume that any pointer which is a multiple of sizeof(void*) is a valid aligned address.

The version of the pixmap cache has been bumped so in theory this should "just work" but I deleted the pixmap cache many times over developing this so I'm not sure. (/var/tmp/kde-cache-$USER/kpc/kde-icon-cache* for me).

Regards,

- Michael Pyne