From kde-core-devel Thu Nov 19 16:14:25 2009 From: Thiago Macieira Date: Thu, 19 Nov 2009 16:14:25 +0000 To: kde-core-devel Subject: Re: mmap failures in KPixmapCache Message-Id: <200911191714.25836.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=125864731428186 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart5429448.3gypUUNLfW" --nextPart5429448.3gypUUNLfW Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Em Quinta-feira 19 Novembro 2009, =E0s 14:49:06, voc=EA escreveu: > Am Donnerstag 19 November 2009 13:57:18 schrieb Thiago Macieira: > > Em Quarta-feira 18 Novembro 2009, =E0s 23:31:25, voc=EA 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 wor= k. > > 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. >=20 > This is definitely not the case for KDevelop. On my system, alone this > simple test application fails: >=20 > " > #include >=20 > 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())); > } > } > " >=20 > It happens with both kernel versions 2.6.31 and 2.6.27. I'm using a 64-bit > kernel and userspace. >=20 > 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 ju= st=20 the full file. =2D-=20 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 --nextPart5429448.3gypUUNLfW Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQBLBW7hM/XwBW70U1gRAr/EAJ9HRr8IuHuHfdm9ndsyEAD8HSkVpwCfR7mq KuEOLi8P2n//7rNxCj7CdVQ= =RoB9 -----END PGP SIGNATURE----- --nextPart5429448.3gypUUNLfW--