[Bug 160284] bad mmap causes cores in KPCMemoryDevice

Michael Pyne mpyne at purinchu.net
Mon Jun 2 23:11:51 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         




------- Additional Comments From mpyne purinchu net  2008-06-02 23:11 -------
SVN commit 815947 by mpyne:

Re-enable mmap'ed pixmap caches.  Sebastian Sauer and I have been troubleshooting this bug (bug 160284).
This patch does the following, which seems to solve all the SIGBUS issues that we could reproduce:

* Unmap the file before recreating the cache in addition to just invalidating it.
* Make the in memory data structure properly aligned for memory accesses.  I did this by making a struct for
  the header information instead of casting a magic address in order to decode information.  This change
  makes the on-disk layout binary incompatible, so I bumped the pixmap cache version.  Older kdelibs
  versions will not read the version from the same byte so in case of a mix of kdelibs versions (if you
  update a running instance for example) I changed the magic character string to fool older kdelibs into
  seeing it as a newer version.  Doing all this work made my earlier attempts to ensure alignment unneeded.
* The deleteCache() is static, so a list is made of all KPixmapCache::Private classes in the process so they
  can cleanly unmap before deleting the cache.
* Resizing of the mmap'ed files is only done if such resizing would make the file bigger.

Although I forgot to disable mmap()ed caches in 4.0 branch I'll go ahead and backport this in case we
do a 4.0.6.

CCBUG:160284


 M  +1 -1      kiconcache.cpp  
 M  +253 -158  kpixmapcache.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=815947


More information about the Kdelibs-bugs mailing list