mmap failures in KPixmapCache

Thiago Macieira thiago at kde.org
Thu Nov 19 12:57:18 GMT 2009


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.

In Qt 4.6, when testing mmap on other platforms, we realised that this didn't 
work on Mac, so we introduced a check to ensure that you don't rely on non-
cross-platform behaviour. That's what KDE was tripping on.

Note that Python has the same limitation:

$ python <<EOF
import os, mmap
f = os.open("/tmp/file", os.O_RDWR | os.O_CREAT, 0644)
mmap.mmap(f, 128
EOF
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
ValueError: mmap length is greater than file size


-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20091119/8efd1840/attachment.sig>


More information about the kde-core-devel mailing list