From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8HJEIec3cF90PAAA0tVLHw (envelope-from ) for ; Sun, 27 Sep 2020 06:57:43 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ikc3Hec3cF8pUwAA1q6Kng (envelope-from ) for ; Sun, 27 Sep 2020 06:57:43 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EADA39400C9 for ; Sun, 27 Sep 2020 06:57:42 +0000 (UTC) Received: from localhost ([::1]:57628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMQPv-0006n0-2i for larch@yhetil.org; Sun, 27 Sep 2020 02:44:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMQPi-0006mo-Oy for guix-patches@gnu.org; Sun, 27 Sep 2020 02:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMQPi-0004o2-Em for guix-patches@gnu.org; Sun, 27 Sep 2020 02:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kMQPi-0001r1-DH for guix-patches@gnu.org; Sun, 27 Sep 2020 02:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all cases of a glibc user not requesting 64-bit offsets and then using readdir. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Sep 2020 06:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43591 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 43591@debbugs.gnu.org, Marius Bakke Received: via spool by 43591-submit@debbugs.gnu.org id=B43591.16011890377108 (code B ref 43591); Sun, 27 Sep 2020 06:44:02 +0000 Received: (at 43591) by debbugs.gnu.org; 27 Sep 2020 06:43:57 +0000 Received: from localhost ([127.0.0.1]:48227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMQPc-0001qa-JR for submit@debbugs.gnu.org; Sun, 27 Sep 2020 02:43:56 -0400 Received: from flashner.co.il ([178.62.234.194]:37156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMQPY-0001qM-A8 for 43591@debbugs.gnu.org; Sun, 27 Sep 2020 02:43:55 -0400 Received: from localhost (unknown [31.210.181.177]) by flashner.co.il (Postfix) with ESMTPSA id 6E6984004A; Sun, 27 Sep 2020 06:43:46 +0000 (UTC) Date: Sun, 27 Sep 2020 09:43:13 +0300 From: Efraim Flashner Message-ID: <20200927064313.GB1386@E5400> References: <20200924141211.21649-1-dannym@scratchpost.org> <87363759at.fsf@gnu.org> <20200924222711.2f22281a@scratchpost.org> <87tuvm4vop.fsf@gnu.org> <20200925122004.38275411@scratchpost.org> <20200925153646.6ef95908@scratchpost.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tsOsTdHNUZQcU9Ye" Content-Disposition: inline In-Reply-To: <20200925153646.6ef95908@scratchpost.org> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.69 X-TUID: fo75OmvMbPgY --tsOsTdHNUZQcU9Ye Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 25, 2020 at 03:36:46PM +0200, Danny Milosavljevic wrote: > > >Why is this not an issue with i686 on x86_64 kernels? =20 > >=20 > > I'm not sure. I'll check. >=20 > $ cat a00.c > #include > #if defined( __ILP32__ ) > #warning ILP32 > #endif > int main() { > return sizeof(off_t); > } > $ LC_ALL=3DC guix environment -s i686-linux gcc-toolchain -- gcc -o a00 a= 00.c > a00.c:3:2: warning: #warning ILP32 [-Wcpp] > 3 | #warning ILP32 > | ^~~~~~~ > $ ./a00 > $ echo $? > 4 >=20 > That means they are using the Linux kernel's X86_32 ABI. > It has its own getdents64 system call that returns another value for d_of= f. >=20 > $ LC_ALL=3DC guix environment -s i686-linux gcc-toolchain -- gcc -o a00 -= D_FILE_OFFSET_BITS=3D64 a00.c > a00.c:3:2: warning: #warning ILP32 [-Wcpp] > 3 | #warning ILP32 > | ^~~~~~~ > $ ./a00 > $ echo $? > 8 >=20 > That is why __i686__ is not affected--at the cost of the kernel lying to = us > about the file system. >=20 > Note that I also tried printing the actual d_off values[1]--on ILP32, eve= n with > _FILE_OFFSET_BITS=3D64, the VALUES are still 32 bits, and the same values= as > without _FILE_OFFSET_BITS. The d_off SLOT gets bigger on _FILE_OFFSET_BI= TS=3D64. >=20 > (I also tried printing the actual d_off values[1] on x86_64 without any g= uix > environment -s, I get entirely different d_off values!!) >=20 > I also tried the former on native ARMHF--you get 32 bits d_off values. A= nd d_off > is always the same size as off_t. >=20 > off_t size changes depending on _FILE_OFFSET_BITS. >=20 > I do not have access to a real aarch64 machine--so no idea how it is ther= e. > That would be the most interesting case, because those don't have X86_32, > so ILP32 is either not present or implemented differently. >=20 > ppc64 would also be interesting... >=20 > Test result of [1]: >=20 > system _FILE_OFFSET_BITS off_t d_off-sizeof d_off-values > ------------------------------------------------------------- > x86_64 - 8 Byte 8 Byte 8 Byte > i686 - 4 Byte 4 Byte 4 Byte > i686 64 8 Byte 8 Byte 4 Byte > i686 32 4 Byte 4 Byte 4 Byte > i686 7 4 Byte 4 Byte 4 Byte > armhf - 4 Byte 4 Byte 4 Byte > armhf 64 8 Byte 8 Byte 4 Byte > armhf 32 4 Byte 4 Byte 4 Byte > armhf 7 4 Byte 4 Byte 4 Byte >=20 > This is all without qemu--in order to simplify the test case. >=20 > So I take it ext4 has some special compilation mode for 32 bits... >=20 > Could someone please test [1] on (real!) aarch64 and ppc64 and ppc32 > machines? >=20 > [1] $ cat a00.c=20 > #include > #include > #include > #include > #if defined( __ILP32__ ) > #warning ILP32 > #endif >=20 > int main() { > DIR* d; > struct dirent* ent; > d =3D opendir("/tmp"); > errno =3D 0; > assert(sizeof(ent->d_off) =3D=3D sizeof(off_t)); > while ((ent =3D readdir(d)) !=3D NULL) { > printf("%llu\n", (unsigned long long) ent->d_off); > } > if (errno) > perror("readdir"); > return sizeof(off_t); missing } at the end tested on my ibook G4: (I believe for powerpc the 32-bit is defined as __powerpc__) (ins)efraim@g4:~$ gcc -o a00 a00.c (ins)efraim@g4:~$ ./a00 404218588 473424804 681064434 708508942 805784207 980330722 1080794671 1734802884 1909818320 1923689764 2019671154 2125602108 2147483647 (ins)efraim@g4:~$ echo $? 4 (ins)efraim@g4:~$ rm a00 (ins)efraim@g4:~$ gcc -o a00 -D_FILE_OFFSET_BITS=3D64 a00.c (ins)efraim@g4:~$ ./a00 404218588 473424804 681064434 708508942 805784207 980330722 1080794671 1734802884 1909818320 1923689764 2019671154 2125602108 2147483647 (ins)efraim@g4:~$ echo $? 8 --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --tsOsTdHNUZQcU9Ye Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl9wNH4ACgkQQarn3Mo9 g1EyqBAAmV7HRvFIVUEaAl6hqRFPSLSE10DYglJCDfKpbAPw7BxomArRHe6YrNcR SFukIry5xSm3/+S5BcpgviT9hmzbMnqRn9blFK20iRzalSo98PjnlZKHoNjs/lwe viVY8pfyNQXGyZFkb6b8MhZw9mvXcX6Zvu7lm5Z5ah8brcxBy4GKsgcKnTyGG2ul mWJHbUCbcjT/HUF5f19FYlglMA6qcCATfhKy7BjpIoD+dWU5Cu35U/8W4CBrKDw/ OTA+HmcVM/SYlxYHnWdSEtcvbF/IBN2YoXY8buxMNs4XKomnDBRvH4y48IJMh9yK giU45l5bTMKXk28G5xs125N7QXejLCuD3P82SsnX5ztKGTxoK8a/ns1B/Il5RKk5 CA/5XwAk3lwa2MYmjNZNzm6hI7qAzCRoWJDrxNFa0mpp305QAACp98+HBnsWmX+e ckrzfPnQVBLfmKxTyv+154GOKDq4/w//dkgBQUYh8cSXOK/ywG/s3xgnNbn5XloV fokxAzN271k7RFukUhWR6vLDNHu2VfvnsfnMQtm7bw2oO+iM5zXVle65PP0JWgDc I25kpqDXtFrCedwxAqV+Ox8zeAR1cxS3mvnC5giFLESS1ROXk3ZteNERsSuKczwW 7Hiprbj11f/7t1JPlgOQP3uz1IItreN8rDE02oh/dL95WaNzonY= =FxbE -----END PGP SIGNATURE----- --tsOsTdHNUZQcU9Ye--