mmap failures in KPixmapCache
Thiago Macieira
thiago at kde.org
Thu Nov 19 16:14:25 GMT 2009
Em Quinta-feira 19 Novembro 2009, às 14:49:06, você escreveu:
> 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.
The testcase above works just fine here. No asserts.
The problem is when you allocate past the end of the file. You allocated just
the full file.
--
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/dc40e307/attachment.sig>
More information about the kde-core-devel
mailing list