mmap failures in KPixmapCache

Michael Pyne mpyne at kde.org
Fri Nov 20 03:21:51 GMT 2009


On Thursday 19 November 2009 07:57:18 Thiago Macieira wrote:
> Em Quarta-feira 18 Novembro 2009, às 23:31:25, você escreveu:
> > I see it here on "Linux parkotron 2.6.31-ARCH #1 SMP PREEMPT Tue Nov
> > 10 19:01:40 CET 2009 x86_64 Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz
> > GenuineIntel GNU/Linux"
> >
> > Unfortunately, I know nothing about, mmapping or QFile::map. It
> > doesn't makes sense for me to report it as I can't provide the
> > relevant details. David, are you able to report it?
> 
> We found the issue. It's a KDE bug.
> 
> KPixmapCache was trying to extend the file by mapping a section of the file
>  past the end, then writing to it. That was never guaranteed to work. In
>  fact, it didn't work outside Linux.

If you're referring to what I think you're referring to (kpixmapcache.cpp:466 
or so) then you're slightly incorrect.

by line 466 info->available should be >= to info->size (which is the bound on 
where KPixmapCache thinks it can write), due to a ftruncate call at line 458.

However this happens after the QFile has already been created, which means 
there's no reason for QFile to know that the size was increased. So I can see 
this as a KDE bug, but not due to overflowing the shared memory buffer, but 
not using the QFile API to resize the file.

I've been working on a reimplementation of the pixmap cache that doesn't suck 
(or sucks less, whichever) but I'm not sure when I'll get enough consecutive 
time to finish it up (and then get it tested!).  Maybe during the holiday 
season. :-/

Let me know if there's something I missed though.

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20091119/a6685056/attachment.sig>


More information about the kde-core-devel mailing list