Bug 163398 - KPixmapCache should remap shared memory when resizing cache
Summary: KPixmapCache should remap shared memory when resizing cache
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: SVN
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-06 22:35 UTC by Michael Pyne
Modified: 2010-05-04 05:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Pyne 2008-06-06 22:35:38 UTC
KPixmapCache can be configured to use shared memory using mmap.  When using
shared memory if the underlying file is resized there is a possibility of
causing errors.

If resized smaller then there is no file where earlier there was one.  If
resized larger, the file will be bigger than the area of memory asked for when
mapped, and what happens if the memory corresponding to the new part of the file
is accessed is implementation-defined.

The file can be resized by using the KPixmapCache::setCacheLimit() function
however I have not developed a testcase yet so I'm not sure if I can make it
crash.

Also see bug 160284 where related mmap usage errors led to crashes.
Comment 1 Michael Pyne 2010-05-04 05:29:18 UTC
SVN commit 1122509 by mpyne:

Now that KPixmapCache is not our only resort, make it safer by removing the ability to
schedule a cache resize for later. This is dangerous in regards to setting a higher cache
size since it is possible for the new size to be used before the file and shared memory
segment have actually been resized to match.

Calling the method that resizes the cache also resizes the file/mmap as a side effect, so
don't wait to do it.

BUG:163398


 M  +4 -62     kpixmapcache.cpp  


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