mmap failures in KPixmapCache

David Nolden zwabel at googlemail.com
Thu Nov 19 13:49:06 GMT 2009


Am Donnerstag 19 November 2009 13:57:18 schrieb Thiago Macieira:
> 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.

This is definitely not the case for KDevelop. On my system, alone this simple 
test application fails:

"
#include <QFile>

int main(int argc, char** argv)
{
  {
    QFile f("maptest.data");
    f.open(QIODevice::WriteOnly);
    f.write("aaaaaaaaaaaaaaaaaaaa", 20);
  }
  {
    QFile f("maptest.data");
    f.open(QIODevice::ReadOnly);
    Q_ASSERT(f.isOpen());
    Q_ASSERT(f.map(0, f.size()));
  }
}
"

It happens with both kernel versions 2.6.31 and 2.6.27. I'm using a 64-bit 
kernel and userspace.

Is this failure reproducible somewhere else? Unfortunately, I don't have the 
qt sources installed, else I would dig into them and check for the actual 
problem.

Greetings, David




More information about the kde-core-devel mailing list