[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kde-4.0.4 segfaults on netbsd sparc
From:       Michael Pyne <mpyne () purinchu ! net>
Date:       2008-05-26 20:31:10
Message-ID: 200805261631.15887.mpyne () purinchu ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/alternative)]


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.

mSizeEntryOffset needs to always point to a properly aligned memory address.  
i.e. if memory accesses must be aligned to a multiple of 16, then 
mSizeEntryOffset must be a multiple of 16.  Note that to my knowledge we won't 
hit this on x86 as that architecture will automatically (but slowly) fix it up 
for us.

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

I'm not sure if this is the same bug.  It depends on what architecture the bug 
reporter is running I think.  I'll try to take a look at it but low-level 
stuff is not my thing. ;)

Regards,
 - Michael Pyne

[Attachment #7 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Consolas'; font-size:11pt; font-weight:400; \
font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Sunday 25 May \
2008, Sebastian Sauer wrote:</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
raymond.meyer@rambler.ru wrote:</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
&gt; I can't start kde on netbsd sparc machine, because kdelibs contains code</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; &gt; that causes segfault. It terminates with "Bus \
error" which indicates</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; unaligned \
memory access. Below is the backtrace.</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
&gt;</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; The problem is with \
kdelibs-4.0.4/kdeui/icons/kpixmapcache.cpp. On line</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">&gt; &gt; 159 it has</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
&gt;</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; *mSize = *((quint32*)(mMemory \
+ mSizeEntryOffset));</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt;</p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; &gt; So looks like a pointer to \
char is cast to a pointer to some form of</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
&gt; uint32_t and then dereferenced. Can anyone suggest a proper fix?</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt;</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
iirc mMemory is the start of a buffer used to cache icons and at</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">&gt; mMemory+mSizeEntryOffset is a 4byte quint32 that is used to know how \
much</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; icons are within those buffer.</p> \
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">mSizeEntryOffset needs to always point to a properly \
aligned memory address.  i.e. if memory accesses must be aligned to a multiple of 16, then \
mSizeEntryOffset must be a multiple of 16.  Note that to my knowledge we won't hit this on x86 \
as that architecture will automatically (but slowly) fix it up for us.</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; https://bugs.kde.org/show_bug.cgi?id=160284</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">I'm not sure if this is the same bug.  It depends on what \
architecture the bug reporter is running I think.  I'll try to take a look at it but low-level \
stuff is not my thing. ;)</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Regards,</p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"> - Michael Pyne</p></body></html>


["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic