[Bug 160284] bad mmap causes cores in KPCMemoryDevice

Michael Pyne mpyne at purinchu.net
Mon Jun 2 06:25:48 CEST 2008


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=160284         
mpyne purinchu net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #24962|0                           |1
        is obsolete|                            |
  Attachment #25030|0                           |1
        is obsolete|                            |



------- Additional Comments From mpyne purinchu net  2008-06-02 06:25 -------
Created an attachment (id=25062)
 --> (http://bugs.kde.org/attachment.cgi?id=25062&action=view)
Alignment + truncated mmap fixes.

Well the good news is that I was able to use Sebastian's method to reproduce
the bug finally.  The bad news is that just using his patch wasn't enough to
stop SIGBUS on my system, although I suspect that could be related to changes I
had locally trying to fix the bug.

However, a little tweaking of his patch for force unmapping the files before
recreating the cache seems to work fine for me.

The other changes I was talking about is to use real structs to ensure that the
alignment is correct (i.e. have gcc do the work, it knows what to do).	In
addition is gets rid of having to have the size entry offset in KPCMemoryDevice
since it can instead just access the mmap'ed memory directly.

With this patch applied I get no crashers.

One catch is how to change the code such that if you were to do something silly
like start opening applications right after reinstalling the fixed kdelibs,
while all your running applications are still going, how do you avoid causing
crashes?  You can't simply bump the version number this time since it's
probably not the exact same spot it was before.  So what I did was change the
magic string slightly (described in the code).

Sebastian, Matthew, could you test the patch and let me know if you still get
crashes so I can commit this tomorrow (assuming it works)?  Thanks.


More information about the Kdelibs-bugs mailing list