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 cjPYD1EObl9XcwAA0tVLHw (envelope-from ) for ; Fri, 25 Sep 2020 15:35:45 +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 uOgrC1EObl8uAQAA1q6Kng (envelope-from ) for ; Fri, 25 Sep 2020 15:35:45 +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 AC7BC94060E for ; Fri, 25 Sep 2020 15:35:44 +0000 (UTC) Received: from localhost ([::1]:36598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLpl8-00060f-UF for larch@yhetil.org; Fri, 25 Sep 2020 11:35:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLpkU-0005xZ-OM for guix-patches@gnu.org; Fri, 25 Sep 2020 11:35:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLpkU-0006pO-Ep for guix-patches@gnu.org; Fri, 25 Sep 2020 11:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kLpkU-0001xu-Bf for guix-patches@gnu.org; Fri, 25 Sep 2020 11:35: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: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Sep 2020 15:35: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: Marius Bakke Cc: 43591@debbugs.gnu.org Received: via spool by 43591-submit@debbugs.gnu.org id=B43591.16010480737503 (code B ref 43591); Fri, 25 Sep 2020 15:35:02 +0000 Received: (at 43591) by debbugs.gnu.org; 25 Sep 2020 15:34:33 +0000 Received: from localhost ([127.0.0.1]:45105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kLpk1-0001wx-2s for submit@debbugs.gnu.org; Fri, 25 Sep 2020 11:34:33 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:37114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kLpjv-0001wj-OD for 43591@debbugs.gnu.org; Fri, 25 Sep 2020 11:34:32 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 118583368166; Fri, 25 Sep 2020 17:34:25 +0200 (CEST) Date: Fri, 25 Sep 2020 17:33:20 +0200 From: Danny Milosavljevic Message-ID: <20200925173320.593e9179@scratchpost.org> In-Reply-To: <20200925153646.6ef95908@scratchpost.org> 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> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/csM3jLd51l.CPCGEeDFa+dD"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) 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: -1.11 X-TUID: YQd7wEhFO+ne --Sig_/csM3jLd51l.CPCGEeDFa+dD Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, I wrote a FUSE filesystem to test what happens with big d_off (I just hard-or-ed a bitmask) and ran it on a real ARMHF machine, then made the pro= gram from before([1] from before) look into that directory. Result (on ARMHF, so real 32 bit machine!): $ gcc --version gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 $ gcc a00.c=20 $ ./a00=20 1737031971 . 1737032035 .. 1737032035 hello $ gcc -D_FILE_OFFSET_BITS=3D64 a00.c=20 $ ./a.out=20 320255973458211 . 320255973458275 .. 320255973458275 hello (Note: Guix gcc-toolchain 10 on ARMHF is still building from source--and will continue to do so for some hours I guess) I only had to patch fuse 2.9.4 (lib/fuse_lowlevel.c) to do this: char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf, off_t off) { unsigned namelen =3D strlen(name); unsigned entlen =3D FUSE_NAME_OFFSET + namelen; unsigned entsize =3D fuse_dirent_size(namelen); unsigned padlen =3D entsize - entlen; struct fuse_dirent *dirent =3D (struct fuse_dirent *) buf; dirent->ino =3D stbuf->st_ino; dirent->off =3D off | 0x1234567890123; // !!!! dirent->namelen =3D namelen; dirent->type =3D (stbuf->st_mode & 0170000) >> 12; strncpy(dirent->name, name, namelen); if (padlen) memset(buf + entlen, 0, padlen); return buf + entsize; } (I DID NOT have to patch the kernel or even have root) So it can happen that you get 64 bit d_off even on real 32 bit machines! That's what I thought--but I still wanted to make sure. And the same on Guix i686 (a00 is [1] from my previous e-mail): $ ./a00-i686 readdir: Value too large for defined data type $ ./a00-i686_flag_32=20 readdir: Value too large for defined data type $ ./a00-i686_flag_64 320255973458211 320255973458275 320255973458275 So there you have it, even on i686--without emulating anything--you can get= a 64 bit d_off value. --Sig_/csM3jLd51l.CPCGEeDFa+dD Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9uDcAACgkQ5xo1VCww uqXHrAf7Bkl5DifcLI6I7rlRy3s0K7YaZv3P+59pkKv5rf/AhRFdOTfn6QHQ/meq ml+xqF29R85vPLFSmjSsx2psqWPA1H5ujj0UrBOJ+5PqjIWbjzz77TnCgBNrnglP kMsvxBUUe477SNa+uQ7TxzycTE1xV2jJ5Pyh5L+kx3JjSSYChVtrn0JvwWfhQSaD x9A9zTzD3GGMTI1PE8uvhKC80PZi4gc8Ov1Qu6gcwBbsTTe82JZsSpd5xezdm4AO 6nvmuHVOaRZXOGNdvAI+Y7l6+EDisMqDNtzpFIEfPeAds0dcNkC8h2DaH547mN+T ULenCL7NaTlOzXd4ST82iiVy6UQpMA== =DzDT -----END PGP SIGNATURE----- --Sig_/csM3jLd51l.CPCGEeDFa+dD--