GNU bug report logs - #43591
[PATCH core-updates] gnu: glibc-final: Catch all cases of a glibc user not requesting 64-bit offsets and then using readdir.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Danny Milosavljevic <dannym@HIDDEN>; Keywords: patch; dated Thu, 24 Sep 2020 14:13:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 6 Oct 2020 15:40:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 06 11:40:12 2020
Received: from localhost ([127.0.0.1]:53942 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kPp4W-0006Q5-A6
	for submit <at> debbugs.gnu.org; Tue, 06 Oct 2020 11:40:12 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:38786)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kPp4U-0006Pv-2M
 for 43591 <at> debbugs.gnu.org; Tue, 06 Oct 2020 11:40:10 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 73BBA336559F;
 Tue,  6 Oct 2020 17:40:08 +0200 (CEST)
Date: Tue, 6 Oct 2020 17:39:32 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20201006173932.08003c1d@HIDDEN>
In-Reply-To: <87o8lmv2nx.fsf@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN> <87tuvf1uet.fsf@HIDDEN>
 <20200930122821.1471d155@HIDDEN> <87o8lmv2nx.fsf@HIDDEN>
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_/440vdPmj4AYN3Vex.7rjJ/C";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/440vdPmj4AYN3Vex.7rjJ/C
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Ludo,

On Thu, 01 Oct 2020 09:14:10 +0200
Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

> Could you propose a patch for maintenance.git?

OK--patch #43829.

> >> I have mixed feelings: fixing packages one by one doesn=E2=80=99t soun=
d great,
> >> but OTOH setting the =E2=80=98CFLAGS=E2=80=99 environment variable glo=
bally can have
> >> unexpected side effects in some cases (overriding package-specific
> >> CFLAGS)=20

Doing (setenv CFLAGS "-g -O2 -D_FILE_OFFSET_BITS=3D64") right after
phase 'set-SOURCE-DATE-EPOCH doesn't override package-specific CFLAGS.

Quite the opposite can happen, though.  But:

> > The latter is easy to detect since I patched dirent.h in glibc exactly =
for that
> > reason.  That way, glibc WON'T let you use it wrong (except if you expl=
icitly
> > ask for it).  On Guix systems, there is no legitimate reason to use it =
wrong
> > in the first place. =20
>=20
> I=E2=80=99m very reluctant to patching public libc headers.  Also, it=E2=
=80=99s not just
> =E2=80=9Cour=E2=80=9D problem, we should definitely discuss it with upstr=
eam and perhaps
> propose your dirent.h patch.

I've reported it upstream.

However, GNU gcc and glibc support a lot of weird architectures--but Guix
system really doesn't.  So it's much easier for us to get a good patch than
it is for them.

> A diff at one point in time (if we ever managed to get a usable diff) is
> not enough: problems could pop up anytime.  Setting =E2=80=98CFLAGS=E2=80=
=99 globally as
> an environment variable seems risky.

We are about 15 years late--so all other distributions already triggered
most of the bugs in that time.  I don't think it's that bad anymore...

That's why I would prefer setting CFLAGS globally anyway.

And I don't have the energy to manually FIND AND fix however many packages
are affected otherwise.

Having this problem in 2020 is ridiculous--it's like someone accidentially
enabled a time machine...

The only reason this didn't fall on our head on x86_64 is because on 64 bit
systems something like it is the default anyway.

--Sig_/440vdPmj4AYN3Vex.7rjJ/C
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl98j7QACgkQ5xo1VCww
uqUvrgf+IotLG5H1B4fcZhvssJhkOrqpzLJmq4n7YnaYiMuUmxAV94jLvyjHWz66
Ab9zW0EFg8eKpR7GpvXI3J35aPUk+aHUb6frhkbp7ky6ItN6IfJYpyNyHJZv3eb4
bmdRAe6uW2a/09oH/Zhtji1cI9CH2tMudfWGfhNUZJwXeM2ZE99HDr4vsSeu0gYu
wEwJMxBdRwnITYofQBbPxnbYGipzLObAErew5zMSpoC4RXPHWbUsNGgkuSlnpSLu
/nUeWfJNkqOLHUj8vsemTyHw+kZ5qVsaKqOpEfjLuqK5ebx65XoDmAezcHwV05d4
4L/P5clGSvZ2ZfD+V1SPGD/b2af7Dg==
=gZXy
-----END PGP SIGNATURE-----

--Sig_/440vdPmj4AYN3Vex.7rjJ/C--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 2 Oct 2020 09:48:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 02 05:48:19 2020
Received: from localhost ([127.0.0.1]:39409 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kOHfm-0007xm-TU
	for submit <at> debbugs.gnu.org; Fri, 02 Oct 2020 05:48:19 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:52382)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kOHfl-0007xd-20
 for 43591 <at> debbugs.gnu.org; Fri, 02 Oct 2020 05:48:17 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 4D567336160B;
 Fri,  2 Oct 2020 11:48:15 +0200 (CEST)
Date: Fri, 2 Oct 2020 11:47:47 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20201002114747.4da6c679@HIDDEN>
In-Reply-To: <20201002101237.3fcf2ef9@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN> <87tuvf1uet.fsf@HIDDEN>
 <20200930122821.1471d155@HIDDEN> <87o8lmv2nx.fsf@HIDDEN>
 <20201001120944.5059c650@HIDDEN>
 <20201002101237.3fcf2ef9@HIDDEN>
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_/akhmE0O04Bb9Tj+7SMxkytf";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 43591
Cc: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>, 43591 <at> debbugs.gnu.org,
 Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

--Sig_/akhmE0O04Bb9Tj+7SMxkytf
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

glibc bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=3D23960

--Sig_/akhmE0O04Bb9Tj+7SMxkytf
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9290MACgkQ5xo1VCww
uqW+/Af9EJhkqXzaTnRfRYtCfIPjCW9i83WYTh75MFwwRSJAzVtrbSObZsvFYzOl
dS1byAbJIHPatHELOD2Fgko5fhX3snl0gmpfTRowjVJGa/ZwLBo8yxx8LVxhMP8U
hCOB+BNjFM7uXkJqvvy6N9mWdS3W9DBy3znZvQnJMYX8z9q7/UVzoSADbWKcZtFs
pbQEhsZvXhbCRZdRjXLun+VHaXKAMHcNJ137HNmdlk2LoaAuiBGsOf2cPyLnXMJA
WzlxqvK6TxiUIgG3FahiyheYzl73mQSjs4QQ2KUfq4faITZVlcYVrrv4dW7KyVKA
ghNyZ2S8/tAMyYttmuS13b/CzvLmDg==
=QFV7
-----END PGP SIGNATURE-----

--Sig_/akhmE0O04Bb9Tj+7SMxkytf--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 2 Oct 2020 09:33:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 02 05:33:11 2020
Received: from localhost ([127.0.0.1]:39370 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kOHR9-0007aM-Jw
	for submit <at> debbugs.gnu.org; Fri, 02 Oct 2020 05:33:11 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:50944)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kOHR5-0007aC-Oq
 for 43591 <at> debbugs.gnu.org; Fri, 02 Oct 2020 05:33:11 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 155B93366D4A;
 Fri,  2 Oct 2020 11:33:06 +0200 (CEST)
Date: Fri, 2 Oct 2020 11:32:38 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20201002113238.33cdf7d2@HIDDEN>
In-Reply-To: <20201001120944.5059c650@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN> <87tuvf1uet.fsf@HIDDEN>
 <20200930122821.1471d155@HIDDEN> <87o8lmv2nx.fsf@HIDDEN>
 <20201001120944.5059c650@HIDDEN>
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_/7.JvKC3Pflh9aFK5TjN+44b";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/7.JvKC3Pflh9aFK5TjN+44b
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Updated table after more tests:

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         FAIL*
i686     32                4 Byte  4 Byte         FAIL*
i686     7                 4 Byte  4 Byte         FAIL*
armhf    -                 4 Byte  4 Byte         FAIL*
armhf    64                8 Byte  8 Byte         8 Byte
armhf    32                4 Byte  4 Byte         FAIL*
armhf    7                 4 Byte  4 Byte         FAIL*
a64armhf -                 4 Byte  4 Byte         FAIL*
a64armhf 64                8 Byte  8 Byte         8 Byte
a64armhf 32                4 Byte  4 Byte         FAIL*
a64armhf 7                 4 Byte  4 Byte         FAIL*=20
aarch64  -                 8 Byte  8 Byte         8 Byte

*: Using FUSE filesystem with big d_off value.

None of those tests were done with qemu.  They were all native.

--Sig_/7.JvKC3Pflh9aFK5TjN+44b
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9287cACgkQ5xo1VCww
uqUAdwgAkp3NKYy6+mUkcQNej0JlQ2sS1GAxbuN6joI/c9eeS9lI8AJYYDd0GnR6
usz1zUJjNToZgngCPyNwz5m+z5ZfFQaLrcqAzNQZUIstYlSSt+rls9kVea3WboZz
rFffZgbOUiEXpHB3udUT+meWqPoWQTVacZ9tELqoBbOfEmYGwKon9qeNuhoxqMqB
xjc35UGJIm+bWskBkpjGOS3xQ2TUSMtUI81pyaOb5BETTymCenjUuxszer5hEuLX
DNZIMsI2UH2Y9GShNod+8KoEyOBSbtLYidoseC7oNYfueHc1y+0MJ/mLp50/KpId
qaT4hf5M1JaxjZgKqZ+lA3oPA2hkKg==
=LHw0
-----END PGP SIGNATURE-----

--Sig_/7.JvKC3Pflh9aFK5TjN+44b--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 2 Oct 2020 08:13:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 02 04:13:10 2020
Received: from localhost ([127.0.0.1]:39302 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kOGBh-0003P1-VO
	for submit <at> debbugs.gnu.org; Fri, 02 Oct 2020 04:13:10 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:43708)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kOGBf-0003Oq-7O
 for 43591 <at> debbugs.gnu.org; Fri, 02 Oct 2020 04:13:08 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id A6C933366B06;
 Fri,  2 Oct 2020 10:13:05 +0200 (CEST)
Date: Fri, 2 Oct 2020 10:12:37 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20201002101237.3fcf2ef9@HIDDEN>
In-Reply-To: <20201001120944.5059c650@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN> <87tuvf1uet.fsf@HIDDEN>
 <20200930122821.1471d155@HIDDEN> <87o8lmv2nx.fsf@HIDDEN>
 <20201001120944.5059c650@HIDDEN>
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_/rvWFGj0c353apP2st4f_j=L";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/rvWFGj0c353apP2st4f_j=L
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

> My patch
> doesn't change anything that users experience at runtime and basically ju=
st
> prevents developers from compiling something that is using readdir without
> thinking about large files first (because they HAVE TO if their programs =
run
> on a host kernel that has bigger d_off--there's no sane way around it).

And just to be clear, they still SHOULD choose whether or not to support
large files even if the host kernel is 32 bit (!!!!)--see table.  It's
just less common there.



--Sig_/rvWFGj0c353apP2st4f_j=L
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl924PUACgkQ5xo1VCww
uqX8ygf+ID5inG0pcZIPcfNYEiGq4/eQJoWpzzxGfmslDCVcDNoq13ey/z9t+xVW
5G4tBNh3ouz3G7rVwTA7FF3SOFvTGYeCPkF605kDDJgvzFSsC0TB3W4tCWZBC0b9
deOPmnfDHTVt+JCKl1YTgCYiMJO8M03zSyT3VWOkoQmjvSwO0poxCqLjWY50ZG6u
f6foIkLloMCZ27S7fBuieTkGoeDtS03PhEAvnMoMrYKMFLllmENAAgXR1n5/jDB7
esjyfiBjOxGZBWmj6a2acr0LKjIAn8yUCuhY++5AfHTsJatw+y2pqpvZwn+rLIYd
0/FGxwjKY3GFQi2oFi7VzVhf7tRvzw==
=z5Zb
-----END PGP SIGNATURE-----

--Sig_/rvWFGj0c353apP2st4f_j=L--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 2 Oct 2020 07:18:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 02 03:18:39 2020
Received: from localhost ([127.0.0.1]:39262 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kOFKw-0008I9-HK
	for submit <at> debbugs.gnu.org; Fri, 02 Oct 2020 03:18:38 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:38776)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kOFKt-0008Hy-MM
 for 43591 <at> debbugs.gnu.org; Fri, 02 Oct 2020 03:18:37 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id A9E13336064C;
 Fri,  2 Oct 2020 09:18:33 +0200 (CEST)
Date: Fri, 2 Oct 2020 09:18:05 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20201001120944.5059c650@HIDDEN>
In-Reply-To: <87o8lmv2nx.fsf@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN> <87tuvf1uet.fsf@HIDDEN>
 <20200930122821.1471d155@HIDDEN> <87o8lmv2nx.fsf@HIDDEN>
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_/ZzHzVZUMIMpot5OdtPvFfu+";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/ZzHzVZUMIMpot5OdtPvFfu+
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Ludo,

On Thu, 01 Oct 2020 09:14:10 +0200
Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

> > This problem has nothing to do with emulation. =20
>=20
> Now I=E2=80=99m lost; I thought this had to do with qemu-user.

I had thought so, too, a few weeks ago.  But that's not the case.

It's not at all related to qemu.

The problem is a fundamental problem: a 64 bit value does NOT fit into a 32=
 bit
slot.

glibc uses getdents64 to get 64 bit dents and then acts all surprised and
errory when it gets 64 bit dents. (also on 32 bit glibc)

The same happens natively when using armhf on aarch64, without qemu-user.
That's what the table I sent was all about.

Calling getdents64 is not the problem--glibc has to do that, otherwise a 32=
 bit
glibc won't work RELIABLY on a 64 bit kernel anyway.

And emitting an error it does because we do not enable large file support.

This table (updated after I finally compiled a guix gcc-toolchain-10 with t=
he
(unpatched) glibc in question on armhf):

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         FAIL*
i686     32                4 Byte  4 Byte         FAIL*
i686     7                 4 Byte  4 Byte         4 Byte
armhf    -                 4 Byte  4 Byte         FAIL*
armhf    64                8 Byte  8 Byte         8 Byte
armhf    32                4 Byte  4 Byte         FAIL*
armhf    7                 4 Byte  4 Byte         FAIL*
a64armhf -                 4 Byte  4 Byte         FAIL*
a64armhf 64                8 Byte  8 Byte         8 Byte
a64armhf 32                4 Byte  4 Byte         FAIL*
a64armhf 7                 4 Byte  4 Byte         FAIL*=20
aarch64  -                 8 Byte  8 Byte         8 Byte

*: Using FUSE filesystem with big d_off value.

None of those tests were done with qemu.  They were all native.

That's why I wanted access to real aarch64 machines--otherwise I could have
done it with qemu on my x86_64 computer :P

> I=E2=80=99m very reluctant to patching public libc headers.

Well, I don't like it either--that's why it's very very careful.  My patch
doesn't change anything that users experience at runtime and basically just
prevents developers from compiling something that is using readdir without
thinking about large files first (because they HAVE TO if their programs run
on a host kernel that has bigger d_off--there's no sane way around it).

If they absolutely want to, they can set _FILE_OFFSET_BITS=3D32 and it will
let them do it (the argument by Marius is that people might want to do that
on embedded.  But that means they'll sometimes have readdir fail--depending
on their setup (also on 32 bit kernels).  Embedded is not specially exempt
from ths bug ;) ).

I think that this patch is guix-specific in the sense that it happens
pretty often that we do "-s i686-linux" on x86_64, "-s armhf-linux" on
aarch64 and expect that to work.  And there's no qemu we could even patch in
those cases, because no qemu is used in the first place.

>  Also, it=E2=80=99s not just
> =E2=80=9Cour=E2=80=9D problem, we should definitely discuss it with upstr=
eam and perhaps
> propose your dirent.h patch.

Sure.  I think 15 years of migration path to 64 bit off_t was more than eno=
ugh.

Now, I'd prefer if glibc made people choose _FILE_OFFSET_BITS explicitly on
32 bit.  Everything else is a hack that WILL break unexpectedly.  Users sti=
ll
can choose _FILE_OFFSET_BITS=3D32, if they want.

> I=E2=80=99m also not sure what you mean by =E2=80=9Cusing it wrong=E2=80=
=9D, what is =E2=80=9Cit=E2=80=9D?

"it" is users calling readdir() without defining _FILE_OFFSET_BITS=3D64 in =
their
source file / Makefile.
This causes glibc to call getdents64 and then act all surprised when it gets
a 64 bit result back.

> > Also, this won't work on armhf or any other 32 bit architecture--so the=
re,
> > we would be both philosophically and practically wrong.
> >
> > Also, the "not telling us the truth for d_off on i686" is a leaky compa=
t layer.
> > It totally DOES wind up telling us the truth sometimes (see my earlier =
test
> > table)--and then we have a problem. =20
>=20
> Hmm I guess I need to re-read all that, I=E2=80=99m overwhelmed.

Yeah--it's understandable.  I'm working on understanding and fixing this pr=
oblem
for a hundred hours now--it took forever for me to get to the bottom of thi=
s,
too.

And in the beginning I, too, suspected qemu.  But it's totally blameless.
Nothing should be changed in qemu-user or in our qemu binfmt service.

The fundamental problem is that POSIX specifies that telldir and seekdir mu=
st
exist, and return and take a LONG, respectively.

That means that glibc has to preserve d_off it got from getdents64 (size is
64 bits), otherwise how would seekdir work?

But the offset parameter of seekdir is standardized as LONG, which means th=
at it
won't work in the first place on 32 bit when there is either a 64 bit kerne=
l or
a filesystem that just happens to store bigger stuff.

So glibc chose to check whether the getdents64 d_off just happens to fit in=
to
the LONG this time around it was called.  I argue that that is insane.  It
would be better to always fail, or never fail--not only fail on the first d=
_off
that is > 2**32.  When that happens is a filesystem implementation detail :P

I think the assumption was that the kernel would store an actual offset into
d_off.  But it doesn't--it stores a hash in the case of ext4 (and probably
in other cases).

And in any case, even if it was an offset, that is still an unsafe way to f=
ix
the problem.

First, someone needs to fix the POSIX standard to say "off_t", not "long".

Then, distributions who want to use 32 bit userland on 64 bit kernel need
to enable large files globally.  That is a choice a distribution has to mak=
e.

Not making a choice is a choice too--the behavior will be random, and if
my research in wip-file-offset-bits-64 is any indication then very
fundamental things will be broken at unexpected places, and usually it DOES
NOT result in a build failure (without my glibc patch).  That basically
means that using 32 bit native on 64 bit kernel cannot be supported in Guix
if no choice is made.

If choice "yes" is made, one needs to have a way to find these
non-build-breaking using-readdir-wrong packages.  How would an alternative
way to do this look?

--Sig_/ZzHzVZUMIMpot5OdtPvFfu+
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl921C0ACgkQ5xo1VCww
uqVaPgf/fIxl8BxRKuGGhS5XYcC2VjATPoqeCdJwh+ewtIhNUd//GAPVz8GLvLlW
kdyReYbVfqYTeQMxvRfurh7ASV3O64fiDMrAMkv1aYmjQXLZrviOI1NgTxDs4GcL
XgSv1sKFLJwuLYqXAlpE9msOkrFX6IPhnprqFfr7OIDQtM6OgBOkWoJ7yW+fU3b0
G+2P52cknDtqLBMFMDH0bGCbILNb+mrQPxYXkJzKYEydWKuErlKnclvLUI88siWX
BAg1LQ88jUjc86PmaJnwHU8nBPj2HrsfabcRNOIOMniSGRRYbFqr4slodVQ7nTzk
tCGBCx9D/Iuvdvll6Lmq7lFuL9c1rQ==
=559R
-----END PGP SIGNATURE-----

--Sig_/ZzHzVZUMIMpot5OdtPvFfu+--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 1 Oct 2020 07:14:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 01 03:14:24 2020
Received: from localhost ([127.0.0.1]:33889 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNsnI-00068a-81
	for submit <at> debbugs.gnu.org; Thu, 01 Oct 2020 03:14:24 -0400
Received: from eggs.gnu.org ([209.51.188.92]:41476)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kNsnF-00068L-Bg
 for 43591 <at> debbugs.gnu.org; Thu, 01 Oct 2020 03:14:22 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:49834)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kNsn9-0001zM-Iu; Thu, 01 Oct 2020 03:14:15 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=33336 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kNsn7-0004E2-Bk; Thu, 01 Oct 2020 03:14:13 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Danny Milosavljevic <dannym@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using
 readdir.
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN> <87tuvf1uet.fsf@HIDDEN>
 <20200930122821.1471d155@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 10 =?utf-8?Q?Vend=C3=A9miaire?= an 229 de la
 =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 01 Oct 2020 09:14:10 +0200
In-Reply-To: <20200930122821.1471d155@HIDDEN> (Danny Milosavljevic's
 message of "Wed, 30 Sep 2020 12:28:21 +0200")
Message-ID: <87o8lmv2nx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Danny Milosavljevic <dannym@HIDDEN> skribis:

> On Wed, 30 Sep 2020 11:32:58 +0200
> Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:
>
>> Dropping emulated builds, or at least 32-bit emulated builds.  We just
>> need to remove build machines from the file above.
>
> Oh.
>
> Do we have real armhf machines?  (as in not aarch64)
>
> *Looks at guix-maintenance*  We do.  Awesome.  Then sure.
>
> But just to be clear, WE MUST NOT USE aarch64 to build armhf as long as t=
his
> problem isn't fixed.
>
> This problem has nothing to do with emulation.

Now I=E2=80=99m lost; I thought this had to do with qemu-user.

Could you propose a patch for maintenance.git?

> I want to know what actually changes in the final binaries.  Surely that =
works
> somehow--guix data services or not.
>
> Basically, for each package in Guix,
>
>   diff -r `~/broken-guix/pre-inst-env guix build $package` `~/fixed-guix/=
pre-inst-env guix build $package` || echo "affected: $package"
>
> but after replacing references by deduplicated content addressed referenc=
es
> (for example if derivation A refers to files in derivation B, but derivat=
ion B
> only changed the directory name it's in and not the content of the deriva=
tion,
> then that should not count as a diff in A.  That should happen recursivel=
y).

Yeah, you =E2=80=9Cjust=E2=80=9D need to compare modulo store file names=E2=
=80=A6

>> I have mixed feelings: fixing packages one by one doesn=E2=80=99t sound =
great,
>> but OTOH setting the =E2=80=98CFLAGS=E2=80=99 environment variable globa=
lly can have
>> unexpected side effects in some cases (overriding package-specific
>> CFLAGS) and zero effects in other cases (for non-Autoconf packages or
>> badly-written =E2=80=98configure.ac=E2=80=99 files), both of which would=
 be hard to
>> detect.
>
> The latter is easy to detect since I patched dirent.h in glibc exactly fo=
r that
> reason.  That way, glibc WON'T let you use it wrong (except if you explic=
itly
> ask for it).  On Guix systems, there is no legitimate reason to use it wr=
ong
> in the first place.

I=E2=80=99m very reluctant to patching public libc headers.  Also, it=E2=80=
=99s not just
=E2=80=9Cour=E2=80=9D problem, we should definitely discuss it with upstrea=
m and perhaps
propose your dirent.h patch.

I=E2=80=99m also not sure what you mean by =E2=80=9Cusing it wrong=E2=80=9D=
, what is =E2=80=9Cit=E2=80=9D?

Building without _FILE_OFFSET_BITS=3D64 is still a valid option, albeit
one that is not recommended.

> About the unexpected side effects--yes, that's right.  That's why we shou=
ld get
> a list of diff results (see above for the command) and then manually look=
 at
> the source code of those packages and their dependencies.

A diff at one point in time (if we ever managed to get a usable diff) is
not enough: problems could pop up anytime.  Setting =E2=80=98CFLAGS=E2=80=
=99 globally as
an environment variable seems risky.

>> If we take a step back: what=E2=80=99s the problem?
>
> It means we have no trustworthy i686 packages, which means we do not have=
 a
> trustworthy full source bootstrap using Mes (since that uses i686 executa=
ble
> to bootstrap).
>
> In practice, this problem is not so bad since the kernel on i686 has a co=
mpat
> layer that hasn't been telling us the truth for d_off, so we should be "g=
ood".
> But philosophically, we are doing it dead wrong.
>
> Also, this won't work on armhf or any other 32 bit architecture--so there,
> we would be both philosophically and practically wrong.
>
> Also, the "not telling us the truth for d_off on i686" is a leaky compat =
layer.
> It totally DOES wind up telling us the truth sometimes (see my earlier te=
st
> table)--and then we have a problem.

Hmm I guess I need to re-read all that, I=E2=80=99m overwhelmed.

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 16:55:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 12:55:54 2020
Received: from localhost ([127.0.0.1]:32924 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNfOU-0001UI-KY
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 12:55:54 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:58370)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNfOS-0001U9-OB
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 12:55:53 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 125ED3367680
 for <43591 <at> debbugs.gnu.org>; Wed, 30 Sep 2020 18:55:51 +0200 (CEST)
Date: Wed, 30 Sep 2020 18:55:21 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: Re: [PATCH core-updates v2 1/5] gnu: glibc-final: Catch all cases
 of a glibc user not requesting 64-bit offsets and then using readdir
 regardless.
Message-ID: <20200930185521.70952954@HIDDEN>
In-Reply-To: <20200930084512.31738-2-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <20200930084512.31738-1-dannym@HIDDEN>
 <20200930084512.31738-2-dannym@HIDDEN>
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_/TLixlpLnwYgzMOQ2Cz7Oh/8";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/TLixlpLnwYgzMOQ2Cz7Oh/8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Still broken: boost.

In file included from ./boost/interprocess/detail/os_file_functions.hpp:40:=
0,
                 from ./boost/interprocess/mapped_region.hpp:29,
                 from libs/log/src/posix/ipc_reliable_message_queue.cpp:51:
./boost/interprocess/detail/os_file_functions.hpp:636:16: error: stray =E2=
=80=98@=E2=80=99 in program
    while((de=3D::readdir(d))) {
[...]
build of /gnu/store/j29v8ph3asv4sywi0437hs6wwd9knvy2-boost-1.74.0.drv failed

That means that boost, or that source file, is not being compiled with
_FILE_OFFSET_BITS=3D64 .

Nowhere does the header file boost/interprocess/detail/os_file_functions.hpp
even check the value of _FILE_OFFSET_BITS.

./libs/filesystem/src/platform_config.hpp is responsible for setting up
_FILE_OFFSET_BITS in general.

That means that platform_config.hpp is not being #included in the former.

boost/interprocess/errors.hpp:// Parts of this code are taken from boost::f=
ilesystem library
boost/interprocess/errors.hpp://  See library home page at http://www.boost=
.org/libs/filesystem

But that means that this does not USE the "filesystem" library and neither =
does
it set _FILE_OFFSET_BITS like the "filesystem" library would.

All this happens even after I added a phase to gnu-build-system to set
_FILE_OFFSET_BITS unconditionally, so boost ignores that, too.

--Sig_/TLixlpLnwYgzMOQ2Cz7Oh/8
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl90uHkACgkQ5xo1VCww
uqWXIQgAoDXHn/Nj7x2sGOXLLOAqD6Tbzk1ti0UhU15/ah9ygp/2aN6oVZOVclnz
7j7ppgdUPT78BaPrQ+LaPvaHmrZuHww7oNGQnIi6LmT47ExOZQwr59wHg/Q5lgx4
XVmWuWQ7tqE+WifAEffRR/TLGEJZwAe54LnwaS/QRtnW7T5gRUvJdgUeV8p0MgPa
f58AVS/zu3R3FSJuI4R0N1tlYZBZqNnykBM7n8gWhsacQKZjlrTNevEx6lS/scDd
yiIH9Po0Xej/B0CAa2fIhx56nBJFq5zdsXBBOV+gZIAvbCpxsOeF5mtOhBDijgKx
QemN1/Vzw56tC9soRwuKLJpvlHtnyg==
=xmR4
-----END PGP SIGNATURE-----

--Sig_/TLixlpLnwYgzMOQ2Cz7Oh/8--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 10:28:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 06:28:55 2020
Received: from localhost ([127.0.0.1]:58329 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNZLz-0001cu-6c
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 06:28:55 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:42794)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNZLw-0001ck-LF
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 06:28:53 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id E32923363688;
 Wed, 30 Sep 2020 12:28:49 +0200 (CEST)
Date: Wed, 30 Sep 2020 12:28:21 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200930122821.1471d155@HIDDEN>
In-Reply-To: <87tuvf1uet.fsf@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN> <87tuvf1uet.fsf@HIDDEN>
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_/Hl9kSUfR.zZukas52q5QGRt";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/Hl9kSUfR.zZukas52q5QGRt
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Ludo,

On Wed, 30 Sep 2020 11:32:58 +0200
Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

> Dropping emulated builds, or at least 32-bit emulated builds.  We just
> need to remove build machines from the file above.

Oh.

Do we have real armhf machines?  (as in not aarch64)

*Looks at guix-maintenance*  We do.  Awesome.  Then sure.

But just to be clear, WE MUST NOT USE aarch64 to build armhf as long as this
problem isn't fixed.

This problem has nothing to do with emulation.

> A change in gnu-build-system would change all the derivations.  I don=E2=
=80=99t
> think the Data Service can help us here.

I want to know what actually changes in the final binaries.  Surely that wo=
rks
somehow--guix data services or not.

Basically, for each package in Guix,

  diff -r `~/broken-guix/pre-inst-env guix build $package` `~/fixed-guix/pr=
e-inst-env guix build $package` || echo "affected: $package"

but after replacing references by deduplicated content addressed references
(for example if derivation A refers to files in derivation B, but derivatio=
n B
only changed the directory name it's in and not the content of the derivati=
on,
then that should not count as a diff in A.  That should happen recursively).

Basically ignore the directory names in /gnu/store and make new directory
names that are the hash of each directory's (recursive) CONTENTS (after
fixing references in that content, too, obviously)--as opposed to sources.
Then diff those.

If necessary, I can run that on my laptop--it will just take several weeks
and miss derivations I don't have in the first place.

> I have mixed feelings: fixing packages one by one doesn=E2=80=99t sound g=
reat,
> but OTOH setting the =E2=80=98CFLAGS=E2=80=99 environment variable global=
ly can have
> unexpected side effects in some cases (overriding package-specific
> CFLAGS) and zero effects in other cases (for non-Autoconf packages or
> badly-written =E2=80=98configure.ac=E2=80=99 files), both of which would =
be hard to
> detect.

The latter is easy to detect since I patched dirent.h in glibc exactly for =
that
reason.  That way, glibc WON'T let you use it wrong (except if you explicit=
ly
ask for it).  On Guix systems, there is no legitimate reason to use it wrong
in the first place.

In my opinion, not having an automated way to tell us when a package is usi=
ng
it wrong would be not doing our due diligence--how would you know we had
actually fixed the problem for good?  You wouldn't know.
And you wouldn't have fixed the problem for good--I can tell you that much =
now.

There already was an essential package, rhash, which didn't pick up the
CFLAGS--and that's how I found it.  It's easy.

About the unexpected side effects--yes, that's right.  That's why we should=
 get
a list of diff results (see above for the command) and then manually look at
the source code of those packages and their dependencies.

> If we take a step back: what=E2=80=99s the problem?

It means we have no trustworthy i686 packages, which means we do not have a
trustworthy full source bootstrap using Mes (since that uses i686 executable
to bootstrap).

In practice, this problem is not so bad since the kernel on i686 has a comp=
at
layer that hasn't been telling us the truth for d_off, so we should be "goo=
d".
But philosophically, we are doing it dead wrong.

Also, this won't work on armhf or any other 32 bit architecture--so there,
we would be both philosophically and practically wrong.

Also, the "not telling us the truth for d_off on i686" is a leaky compat la=
yer.
It totally DOES wind up telling us the truth sometimes (see my earlier test
table)--and then we have a problem.

>  Then we have packages that do not
> support large files; it=E2=80=99s not great but evidently we can live wit=
h it.
> :-)  Ideally, we=E2=80=99d report it upstream when we encounter it.

I really don't care about large file support.  That's mostly a bonus we get
while fixing this whole ordeal the right way.  That said, maybe users
care they actually can store a 5 GiB file on their 4000 GiB drive on armhf =
:P

> So to me that hints at targeted fixes: fixing key packages like CMake
> (roughly what you already did) where lack of large file support can be
> problematic.

As long as we patch glibc's dirent.h so it tells us when we are doing stupid
stuff, we can't go wrong much.  So sure.

As I said, the main problem is FINDING the affected packages.  It's not like
they'll fail building (in general).  They'll just do weird stuff at runtime
instead.  Case in point: cmake DID NOT fail building.  And it totally is
broken.

Everything after that is easy.

--Sig_/Hl9kSUfR.zZukas52q5QGRt
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl90XcUACgkQ5xo1VCww
uqXKxgf/foOlL/5z3NtiynHPzBn2e/EqziNnVXtSjZaPMdvmK4N09rvWBFLDZ3Rl
dOBfMTuwhiY63BbhmmSXngYdO8USLxRoEn1GCgcYrjLt2YzfxGPaQ5xyrXV0FhDR
l5UNQPNcqwk2qfK6kmmzg2qCoRG0C8+/MSt6QPGQLZ4U1JNfMuKqDFVoGR7sJW15
sLOH62x+WvIpOq8sXmHzeeguN1Aj01VaNvWWg5g0inBkqM5FcB1Q3JOxIAFnFsuf
hH2YGqOfqlz/o9hIYHYOSQt9FcwtuBVurz4fac0QmKnNlVQ8Qj2UKuD26LO5BBT3
YR3MH6yIPKc8tMSU2XnnmhnE2hPS6Q==
=/PXl
-----END PGP SIGNATURE-----

--Sig_/Hl9kSUfR.zZukas52q5QGRt--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 09:33:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 05:33:12 2020
Received: from localhost ([127.0.0.1]:58234 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNYU4-0006TR-38
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 05:33:12 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56102)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kNYU2-0006TF-21
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 05:33:10 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:58764)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kNYTu-0002ua-QK; Wed, 30 Sep 2020 05:33:02 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58754 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kNYTr-0003Gb-Dd; Wed, 30 Sep 2020 05:33:00 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Danny Milosavljevic <dannym@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using
 readdir.
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
 <20200930000934.6812b7c8@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 9 =?utf-8?Q?Vend=C3=A9miaire?= an 229 de la
 =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Wed, 30 Sep 2020 11:32:58 +0200
In-Reply-To: <20200930000934.6812b7c8@HIDDEN> (Danny Milosavljevic's
 message of "Wed, 30 Sep 2020 00:09:34 +0200")
Message-ID: <87tuvf1uet.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Danny Milosavljevic <dannym@HIDDEN> skribis:

> On Tue, 29 Sep 2020 22:52:10 +0200
> Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:
>
>> Marius Bakke <marius@HIDDEN> skribis:
>>=20
>> > Arguably running code for foreign architectures through QEMU binfmt is
>> > something of a hack.  Mandating that every package *must* be patched to
>> > support it seems user-hostile.  I'm more in favor of dropping it on the
>> > build farm, or just keep fixing things on a per-package basis.=20=20
>>=20
>> I=E2=80=99m fine with dropping things on the build farm; it=E2=80=99s ju=
st about
>> modifying machines-for-berlin.scm in maintenance.git.  Any takers?  :-)
>
> I don't know what "dropping things on the build farm" means in this conte=
xt.
> Dropping what exactly?

Dropping emulated builds, or at least 32-bit emulated builds.  We just
need to remove build machines from the file above.

>> The above would override the default CFLAGS in Autoconf-generated
>> configure scripts (which is =E2=80=9C-O2 -g=E2=80=9D).=20=20
>
> That is correct.  I'm currently working on v2 (testing a patchset already)
> and I totally forgot to add "-g -O2" the first time around.  Also, glibc
> itself must NOT have -D_FILE_OFFSET_BITS=3D64 (it makes sense not to, too=
).
>
>>So we=E2=80=99d have to be cautious.
>> But I think a global solution is preferable to adding
>> -D_FILE_OFFSET_BITS=3D64 to tens of packages.
>
> I agree.
>
> I still would like to see what actually changes--and I think with
> guix-data-services it should actually be possible to compare derivations
> before-and-after and find out which derivations of which packages changed
> at all because of the global -D_FILE_OFFSET_BITS=3D64.  I'd like some help
> using guix-data-services to find that out.  Otherwise a risk estimation
> cannot be done.

A change in gnu-build-system would change all the derivations.  I don=E2=80=
=99t
think the Data Service can help us here.

> Technically, if a package used direct assembly offsets (for some unfathom=
able
> reason), it could have an undetectable problem with the size change of of=
f_t
> (and also struct dirent).  So examining the source code of the most essen=
tial
> packages manually is still good.  That's what I did in
> branch wip-file-offsets-64.

Yeah.

> I'm in the process of testing a patchset that globally sets
>
>   CFLAGS=3D"-D_FILE_OFFSET_BITS=3D64 -g -O2"
>
> instead.

OK.

> That alone is not enough since there are a lot of non-autotools projects =
that
> just ignore the environment variable entirely--not to mention languages o=
ther
> than C.

Yeah=E2=80=A6

I have mixed feelings: fixing packages one by one doesn=E2=80=99t sound gre=
at,
but OTOH setting the =E2=80=98CFLAGS=E2=80=99 environment variable globally=
 can have
unexpected side effects in some cases (overriding package-specific
CFLAGS) and zero effects in other cases (for non-Autoconf packages or
badly-written =E2=80=98configure.ac=E2=80=99 files), both of which would be=
 hard to
detect.

~~~

If we take a step back: what=E2=80=99s the problem?  We have a problem with
emulated 32-bit architectures on 64-bit architectures.  But that=E2=80=99s =
OK,
we can stop those emulations for now.  Then we have packages that do not
support large files; it=E2=80=99s not great but evidently we can live with =
it.
:-)  Ideally, we=E2=80=99d report it upstream when we encounter it.

So to me that hints at targeted fixes: fixing key packages like CMake
(roughly what you already did) where lack of large file support can be
problematic.

Thoughts?

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 08:46:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 04:46:02 2020
Received: from localhost ([127.0.0.1]:58087 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNXkP-0005G3-O1
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:46:02 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:33130)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNXkM-0005Ey-9G
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:45:58 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id EF1093363599;
 Wed, 30 Sep 2020 10:45:56 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: [PATCH core-updates v2 5/5] gnu: rhash: Explicity declare the
 _FILE_OFFSET_BITS we want.
Date: Wed, 30 Sep 2020 10:45:12 +0200
Message-Id: <20200930084512.31738-6-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200930084512.31738-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <20200930084512.31738-1-dannym@HIDDEN>
MIME-Version: 1.0
Tags: patch
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* gnu/packages/crypto.scm (rhash)[arguments]<#:make-flags>:
Explicity declare the _FILE_OFFSET_BITS we want.
---
 gnu/packages/crypto.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index 028c140185..a10dd62e8b 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -845,8 +845,13 @@ BLAKE.")
                                       "/bin/" ,target "-gcc"))
                      '())))
        #:make-flags
-       ;; The binaries in /bin need some help finding librhash.so.0.
-       (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
+       (list ;; This package uses a configure script that is not from GNU
+             ;; autotools; it doesn't handle the environment variable
+             ;; CFLAGS (or for that matter the configure option).
+             ;; Therefore, directly pass it to make.
+             "CFLAGS=-D_FILE_OFFSET_BITS=64"
+             ;; The binaries in /bin need some help finding librhash.so.0.
+             (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
        #:test-target "test"             ; ‘make check’ just checks the sources
        #:phases
        (modify-phases %standard-phases




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 08:46:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 04:46:01 2020
Received: from localhost ([127.0.0.1]:58085 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNXkP-0005Fq-8X
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:46:01 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:33116)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNXkL-0005El-8G
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:45:58 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id EB5613362FBA;
 Wed, 30 Sep 2020 10:45:55 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: [PATCH core-updates v2 1/5] gnu: glibc-final: Catch all cases of a
 glibc user not requesting 64-bit offsets and then using readdir regardless.
Date: Wed, 30 Sep 2020 10:45:08 +0200
Message-Id: <20200930084512.31738-2-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200930084512.31738-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <20200930084512.31738-1-dannym@HIDDEN>
MIME-Version: 1.0
Tags: patch
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* gnu/packages/commencement.scm (glibc-final): Catch all cases of a glibc user not
requesting 64-bit offsets and then using readdir.
---
 gnu/packages/commencement.scm | 68 ++++++++++++++++++++++++++++++++++-
 1 file changed, 67 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index e5a4caa95c..284fa65d20 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3462,7 +3462,73 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                ,hurd-headers-boot0)
              '())
        ,@(package-outputs glibc-final-with-bootstrap-bash))
-      ,@(package-arguments glibc-final-with-bootstrap-bash)))))
+      ,@(substitute-keyword-arguments
+         (package-arguments glibc-final-with-bootstrap-bash)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'patch-dirent
+               (lambda* (#:key outputs #:allow-other-keys)
+                 ;; Linux kernel file offsets are always 64 bits.
+                 ;; But userspace can be built to use 32 bit offsets.
+                 ;;
+                 ;; "struct dirent", returned by readdir, uses d_off to store
+                 ;; such an "offset" that it got from the Linux kernel.
+                 ;; In the case of ext4 that "offset" is actually a 64 bit
+                 ;; hash value.
+                 ;;
+                 ;; Therefore, there are cases where such an offset that it got
+                 ;; from the Linux kernel does not fit in the "struct dirent"
+                 ;; field "d_off".
+                 ;;
+                 ;; If the guest system's glibc is 32 bit AND uses 32 bit
+                 ;; file offsets it is going to be very confused.
+                 ;; It does check whether d_off fits into the structure
+                 ;; it gives back to the user--and it doesn't fit.  Hence readdir
+                 ;; fails, with errno == EOVERFLOW (which is undocumented and thus
+                 ;; an API error).
+                 ;; This manifests itself in simple directory reads not working
+                 ;; anymore in parts of cmake, for example.
+                 ;;
+                 ;; This manifested in Guix when building stuff for
+                 ;; ARMHF on a x86_64 build host using QEMU transparent emulation.
+                 ;;
+                 ;; There is a very simple and complete way to avoid this problem:
+                 ;; Just always use 64 bit offsets in user space programs (also
+                 ;; on 32 bit machines).  The Linux kernel does that already
+                 ;; anyway.
+                 ;;
+                 ;; Note: We might want to avoid using 64 bit when bootstrapping
+                 ;; using mescc (since mescc doesn't directly support 64 bit
+                 ;; values)--but then bootstrapping has to be done on a
+                 ;; file system other than ext4, or on ext4 with the feature
+                 ;; "dir_index" disabled.
+                 ;;
+                 ;; The change below does not affect 64 bit users.
+                 ;;
+                 ;; See <https://issues.guix.gnu.org/43513>.
+                 (let ((port (open-file "dirent/dirent.h" "a")))
+                   (display "
+#ifndef _LIBC
+#if __SIZEOF_LONG__ < 8
+#ifndef __USE_FILE_OFFSET64
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 32
+#warning \"Using -D_FILE_OFFSET_BITS=32 and using readdir is a bad idea, see <https://bugzilla.kernel.org/show_bug.cgi?id=205957>\"
+#else
+#undef readdir
+#define readdir @READDIR_WITHOUT_FILE_OFFSET64_IS_A_REALLY_BAD_IDEA@
+#endif
+#endif
+#endif
+#endif
+" port)
+                   (close-port port))
+                 ;; This file includes <dirent.h> and thus checks sanity already.
+                 ;; TODO: Check dirent/scandir-tail.c, dirent/scandir64-tail.c.
+                 (substitute* "posix/glob.c"
+                  (("(#[ ]*define[ ][ ]*readdir)") "
+#undef readdir
+#define readdir"))
+                 #t)))))))))
 
 (define/system-dependent gcc-boot0-wrapped
   ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 08:46:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 04:46:01 2020
Received: from localhost ([127.0.0.1]:58083 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNXkO-0005Fi-UX
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:46:01 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:33118)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNXkL-0005En-8F
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:45:58 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 365DD336344D;
 Wed, 30 Sep 2020 10:45:56 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: [PATCH core-updates v2 2/5] build-system/gnu: Explicity declare the
 _FILE_OFFSET_BITS we want.
Date: Wed, 30 Sep 2020 10:45:09 +0200
Message-Id: <20200930084512.31738-3-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200930084512.31738-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <20200930084512.31738-1-dannym@HIDDEN>
MIME-Version: 1.0
Tags: patch
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* guix/build/gnu-build-system.scm (set-FILE-OFFSET-BITS): New procedure.
(%standard-phases): Add it.
---
 guix/build/gnu-build-system.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index d3347c9518..1a1c4627ab 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -60,6 +60,17 @@ See https://reproducible-builds.org/specs/source-date-epoch/."
   (setenv "SOURCE_DATE_EPOCH" "1")
   #t)
 
+(define* (set-FILE-OFFSET-BITS #:rest _)
+  "Define '_FILE_OFFSET_BITS' using the C preprocessor.
+This ensures that 32 bit and 64 bit user space both can handle results
+returned from a 64 bit kernel.
+See https://bugzilla.kernel.org/show_bug.cgi?id=205957."
+  ;; Setting CFLAGS here makes packages not default CFLAGS.
+  ;; Since glibc (and probably other packages) don't like being built without optimization, enable optimization here.
+  (setenv "CFLAGS" "-D_FILE_OFFSET_BITS=64 -g -O2")
+  (setenv "CXXFLAGS" "-D_FILE_OFFSET_BITS=64 -g -O2")
+  #t)
+
 (define (first-subdirectory directory)
   "Return the file name of the first sub-directory of DIRECTORY."
   (match (scandir directory
@@ -803,7 +814,7 @@ which cannot be found~%"
   ;; Standard build phases, as a list of symbol/procedure pairs.
   (let-syntax ((phases (syntax-rules ()
                          ((_ p ...) `((p . ,p) ...)))))
-    (phases set-SOURCE-DATE-EPOCH set-paths install-locale unpack
+    (phases set-SOURCE-DATE-EPOCH set-FILE-OFFSET-BITS set-paths install-locale unpack
             bootstrap
             patch-usr-bin-file
             patch-source-shebangs configure patch-generated-file-shebangs




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 08:46:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 04:46:00 2020
Received: from localhost ([127.0.0.1]:58081 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNXkO-0005Fb-4g
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:46:00 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:33122)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNXkL-0005Ep-FD
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:45:58 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id B52683363452;
 Wed, 30 Sep 2020 10:45:56 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: [PATCH core-updates v2 4/5] gnu: glibc-mesboot0: Do not explicitly
 set _FILE_OFFSET_BITS.
Date: Wed, 30 Sep 2020 10:45:11 +0200
Message-Id: <20200930084512.31738-5-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200930084512.31738-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <20200930084512.31738-1-dannym@HIDDEN>
MIME-Version: 1.0
Tags: patch
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* gnu/packages/commencement.scm (glibc-mesboot0)[arguments]<#:phases>[set-FILE-OFFSET-BITS]:
Delete phase.
---
 gnu/packages/commencement.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 284fa65d20..ad6a27ba6b 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1398,6 +1398,8 @@ ac_cv_c_float_format='IEEE (little-endian)'
            ,(string-append "--prefix=" out)))
        #:phases
        (modify-phases %standard-phases
+         ;; glibc itself should support both--so don't choose here.
+         (delete 'set-FILE-OFFSET-BITS)
          (add-after 'unpack 'apply-boot-patch
            (lambda* (#:key inputs #:allow-other-keys)
              (and (let ((patch (assoc-ref inputs "boot-patch")))




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 08:46:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 04:46:00 2020
Received: from localhost ([127.0.0.1]:58079 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNXkN-0005FT-Rk
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:46:00 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:33114)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNXkL-0005Ek-Ak
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:45:58 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id ADC283362C2B;
 Wed, 30 Sep 2020 10:45:55 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: [PATCH core-updates v2 0/5] gnu: glibc-final: Catch all cases of a
 glibc user not requesting 64-bit offsets and then using readdir.
Date: Wed, 30 Sep 2020 10:45:07 +0200
Message-Id: <20200930084512.31738-1-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200924141211.21649-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
MIME-Version: 1.0
Tags: patch
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Linux kernel file offsets are always 64 bits.
But userspace can be built to use 32 bit offsets.

"struct dirent", returned by readdir, uses d_off to store
such an "offset" that it got from the Linux kernel.
In the case of ext4 that "offset" is actually a 64 bit
hash value.

Therefore, there are cases where such an offset that it got
from the Linux kernel does not fit in the "struct dirent"
field "d_off".

If the guest system's glibc is 32 bit AND uses 32 bit
file offsets it is going to be very confused.
It does check whether d_off fits into the structure
it gives back to the user--and it doesn't fit.  Hence readdir
fails, with errno == EOVERFLOW (which is undocumented and thus
an API error).
This manifests itself in simple directory reads not working
anymore in parts of cmake, for example.

This happened in Guix when building stuff for
ARMHF on a x86_64 build host using QEMU transparent emulation.

There is a very simple and complete way to avoid this problem:
Just always use 64 bit offsets in user space programs (also
on 32 bit machines).

Danny Milosavljevic (5):
  gnu: glibc-final: Catch all cases of a glibc user not requesting
    64-bit offsets and then using readdir regardless.
  build-system/gnu: Explicity declare the _FILE_OFFSET_BITS we want.
  gnu: glibc: Do not explicitly set _FILE_OFFSET_BITS.
  gnu: glibc-mesboot0: Do not explicitly set _FILE_OFFSET_BITS.
  gnu: rhash: Explicity declare the _FILE_OFFSET_BITS we want.

 gnu/packages/base.scm           |  2 +
 gnu/packages/commencement.scm   | 70 ++++++++++++++++++++++++++++++++-
 gnu/packages/crypto.scm         |  9 ++++-
 guix/build/gnu-build-system.scm | 13 +++++-
 4 files changed, 90 insertions(+), 4 deletions(-)





Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 30 Sep 2020 08:46:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 30 04:45:59 2020
Received: from localhost ([127.0.0.1]:58077 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNXkN-0005FR-KH
	for submit <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:45:59 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:33120)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNXkL-0005Eo-Ag
 for 43591 <at> debbugs.gnu.org; Wed, 30 Sep 2020 04:45:57 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 77B233363306;
 Wed, 30 Sep 2020 10:45:56 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: [PATCH core-updates v2 3/5] gnu: glibc: Do not explicitly set
 _FILE_OFFSET_BITS.
Date: Wed, 30 Sep 2020 10:45:10 +0200
Message-Id: <20200930084512.31738-4-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200930084512.31738-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <20200930084512.31738-1-dannym@HIDDEN>
MIME-Version: 1.0
Tags: patch
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* gnu/packages/base.scm (glibc)[arguments]<#:phases>[set-FILE-OFFSET-BITS]:
Delete phase.
---
 gnu/packages/base.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 41976c5ab0..6f3c717b50 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -782,6 +782,8 @@ the store.")
 
       #:tests? #f                                 ; XXX
       #:phases (modify-phases %standard-phases
+                 ;; glibc itself should support both--so don't choose here.
+                 (delete 'set-FILE-OFFSET-BITS)
                  (add-before
                   'configure 'pre-configure
                   (lambda* (#:key inputs native-inputs outputs




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 29 Sep 2020 22:10:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 29 18:10:04 2020
Received: from localhost ([127.0.0.1]:57430 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNNoy-0001yS-Kt
	for submit <at> debbugs.gnu.org; Tue, 29 Sep 2020 18:10:04 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:34450)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNNow-0001xw-72
 for 43591 <at> debbugs.gnu.org; Tue, 29 Sep 2020 18:10:03 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 9150F33640C3;
 Wed, 30 Sep 2020 00:10:00 +0200 (CEST)
Date: Wed, 30 Sep 2020 00:09:34 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200930000934.6812b7c8@HIDDEN>
In-Reply-To: <87h7rg4879.fsf@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <87h7rg4879.fsf@HIDDEN>
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_/=5Hj0j0dlOK_SAu_+/Kcfbf";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/=5Hj0j0dlOK_SAu_+/Kcfbf
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Ludo,

On Tue, 29 Sep 2020 22:52:10 +0200
Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

> Marius Bakke <marius@HIDDEN> skribis:
>=20
> > Arguably running code for foreign architectures through QEMU binfmt is
> > something of a hack.  Mandating that every package *must* be patched to
> > support it seems user-hostile.  I'm more in favor of dropping it on the
> > build farm, or just keep fixing things on a per-package basis. =20
>=20
> I=E2=80=99m fine with dropping things on the build farm; it=E2=80=99s jus=
t about
> modifying machines-for-berlin.scm in maintenance.git.  Any takers?  :-)

I don't know what "dropping things on the build farm" means in this context.
Dropping what exactly?

> The above would override the default CFLAGS in Autoconf-generated
> configure scripts (which is =E2=80=9C-O2 -g=E2=80=9D). =20

That is correct.  I'm currently working on v2 (testing a patchset already)
and I totally forgot to add "-g -O2" the first time around.  Also, glibc
itself must NOT have -D_FILE_OFFSET_BITS=3D64 (it makes sense not to, too).

>So we=E2=80=99d have to be cautious.
> But I think a global solution is preferable to adding
> -D_FILE_OFFSET_BITS=3D64 to tens of packages.

I agree.

I still would like to see what actually changes--and I think with
guix-data-services it should actually be possible to compare derivations
before-and-after and find out which derivations of which packages changed
at all because of the global -D_FILE_OFFSET_BITS=3D64.  I'd like some help
using guix-data-services to find that out.  Otherwise a risk estimation
cannot be done.

Technically, if a package used direct assembly offsets (for some unfathomab=
le
reason), it could have an undetectable problem with the size change of off_t
(and also struct dirent).  So examining the source code of the most essenti=
al
packages manually is still good.  That's what I did in
branch wip-file-offsets-64.

I'm in the process of testing a patchset that globally sets

  CFLAGS=3D"-D_FILE_OFFSET_BITS=3D64 -g -O2"

instead.

That alone is not enough since there are a lot of non-autotools projects th=
at
just ignore the environment variable entirely--not to mention languages oth=
er
than C.

I have access to bayfront--but I don't remember how to evaluate a new branch
there  (the new branch is "wip-file-offset-bits-64-sledgehammer").  How does
it work?

--Sig_/=5Hj0j0dlOK_SAu_+/Kcfbf
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9zsJ4ACgkQ5xo1VCww
uqX2cQgAmvzuWUzAWHm6T9M58P3PhM7dlK5gtkowB3hgxzYk/KkpluX56HXE2P54
q+m78K5rumyDkoVVtMtsAQbrJLnd+HuHOrlwBipcTuBsCPJ6r7Fc4BMVbvfm/kvd
y7fxqsmDybtrynFpUNiQadQZNT//NaSRLqa7XKv7HWblmGYVwuQ0+fdj+IEqUv5X
3l8h/ziDg2vB10rmtmFzh9kjN/lGsYYfHlnY87iNqoYbtY4Klkg9xQiGpKULWdA4
tUATpX9JsHpAmMYN/Rja3Yk1inpMZ4aWpSdYETZGi90WvItyrp8tSlsK0uqh7/Ak
8u39izKY7Yx4fNKDJqtUiy2DHHQW9g==
=F4u0
-----END PGP SIGNATURE-----

--Sig_/=5Hj0j0dlOK_SAu_+/Kcfbf--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 29 Sep 2020 20:52:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 29 16:52:20 2020
Received: from localhost ([127.0.0.1]:57308 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNMbk-0008WH-1K
	for submit <at> debbugs.gnu.org; Tue, 29 Sep 2020 16:52:20 -0400
Received: from eggs.gnu.org ([209.51.188.92]:59832)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kNMbi-0008W4-Fr
 for 43591 <at> debbugs.gnu.org; Tue, 29 Sep 2020 16:52:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47506)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kNMbc-0007y4-Ip; Tue, 29 Sep 2020 16:52:12 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57482 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kNMbb-0004Ox-Ex; Tue, 29 Sep 2020 16:52:11 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using
 readdir.
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN>
Date: Tue, 29 Sep 2020 22:52:10 +0200
In-Reply-To: <87tuvm4vop.fsf@HIDDEN> (Marius Bakke's message of "Fri, 25 Sep
 2020 01:11:18 +0200")
Message-ID: <87h7rg4879.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>, 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Marius Bakke <marius@HIDDEN> skribis:

> Arguably running code for foreign architectures through QEMU binfmt is
> something of a hack.  Mandating that every package *must* be patched to
> support it seems user-hostile.  I'm more in favor of dropping it on the
> build farm, or just keep fixing things on a per-package basis.

I=E2=80=99m fine with dropping things on the build farm; it=E2=80=99s just =
about
modifying machines-for-berlin.scm in maintenance.git.  Any takers?  :-)

> A less user-hostile solution could perhaps be to (setenv "CFLAGS"
> "-D_FILE_OFFSET_BITS=3D64") on 32-bit architectures in gnu-build-system.
> Not sure whether that could cause any adverse effects.  But again, I
> don't like the idea of optimizing for QEMUs user-mode emulation.

The above would override the default CFLAGS in Autoconf-generated
configure scripts (which is =E2=80=9C-O2 -g=E2=80=9D).  So we=E2=80=99d hav=
e to be cautious.
But I think a global solution is preferable to adding
-D_FILE_OFFSET_BITS=3D64 to tens of packages.

WDYT?

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 29 Sep 2020 14:52:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 29 10:52:16 2020
Received: from localhost ([127.0.0.1]:56893 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kNGzI-0008D9-LW
	for submit <at> debbugs.gnu.org; Tue, 29 Sep 2020 10:52:16 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:52864)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kNGzG-0008D0-Ha
 for 43591 <at> debbugs.gnu.org; Tue, 29 Sep 2020 10:52:15 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 54F4C3361525;
 Tue, 29 Sep 2020 16:52:12 +0200 (CEST)
Date: Tue, 29 Sep 2020 16:51:45 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200929165145.5d6b4434@HIDDEN>
In-Reply-To: <20200926034912.6ad44194@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <20200925122004.38275411@HIDDEN>
 <20200925153646.6ef95908@HIDDEN>
 <20200926034244.1aa3c4f6@HIDDEN>
 <20200926034912.6ad44194@HIDDEN>
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_/L=t12vFZjN+0P+pJDOGhReK";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/L=t12vFZjN+0P+pJDOGhReK
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

(Note: ILP32 is not present on aarch64)

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         FAIL*
i686     32                4 Byte  4 Byte         FAIL*
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
a64armhf -                 4 Byte  4 Byte         FAIL*
a64armhf 64                8 Byte  8 Byte         8 Byte
a64armhf 32                4 Byte  4 Byte         FAIL*
a64armhf 7                 4 Byte  4 Byte         FAIL*=20
aarch64  -                 8 Byte  8 Byte         8 Byte

*: Using FUSE filesystem with big d_off value.

--Sig_/L=t12vFZjN+0P+pJDOGhReK
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9zSgEACgkQ5xo1VCww
uqWFbAgAnExo/8+26P+b98euZLJ++EQl74LB++acJmgQl5Qq+upiUQz+QyTp9fNp
WZHfv7mP9z9pHcOsYsDnFWTdwPiSkYXkDAlqxHedqptA/d8ZjHgUg32JQ4Q7ZXxr
aCyhAk7ej0QYxfDXaduOAJ1rT+7wtBoRDO5XMSz6kKdL66c1UCHv/RhmhV0eq2FQ
kg23P0T+VzWxuII1O/uFgrPdawkKletbL1eGy0u9KncIQMEp2o9iPX0b0rmLRVfP
szOgrhY9lD/+VNnl61aB98OQLoWupXadKlI0sthXvjJYFuY/tXygfGlreqDSqKJr
HgX022VdkFn3OX9qW2sZHCvU89E0jg==
=Kiu1
-----END PGP SIGNATURE-----

--Sig_/L=t12vFZjN+0P+pJDOGhReK--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 27 Sep 2020 06:43:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 27 02:43:56 2020
Received: from localhost ([127.0.0.1]:48227 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kMQPc-0001qa-JR
	for submit <at> 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 <efraim@HIDDEN>) id 1kMQPY-0001qM-A8
 for 43591 <at> 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 <efraim@HIDDEN>
To: Danny Milosavljevic <dannym@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200927064313.GB1386@E5400>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <20200925122004.38275411@HIDDEN>
 <20200925153646.6ef95908@HIDDEN>
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@HIDDEN>
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-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--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 <stdio.h>
> #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 <stdio.h>
> #include <errno.h>
> #include <assert.h>
> #include <dirent.h>
> #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   <efraim@HIDDEN>   =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--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 26 Sep 2020 10:51:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 26 06:51:28 2020
Received: from localhost ([127.0.0.1]:45900 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kM7nb-0006EF-Ss
	for submit <at> debbugs.gnu.org; Sat, 26 Sep 2020 06:51:28 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:57488)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kM7nW-0006E2-7o
 for 43591 <at> debbugs.gnu.org; Sat, 26 Sep 2020 06:51:26 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 7E41033655C7;
 Sat, 26 Sep 2020 12:51:19 +0200 (CEST)
Date: Sat, 26 Sep 2020 12:50:28 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Andreas Enge <andreas@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200926124758.28866f16@HIDDEN>
In-Reply-To: <20200925200323.GB5828@jurong>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <20200925200323.GB5828@jurong>
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_/ohbs4dDz2j4tVMjKeiMrOgB";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org, Marius Bakke <marius@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/ohbs4dDz2j4tVMjKeiMrOgB
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi Andreas,

On Fri, 25 Sep 2020 22:03:23 +0200
Andreas Enge <andreas@HIDDEN> wrote:

> On Fri, Sep 25, 2020 at 01:11:18AM +0200, Marius Bakke wrote:
> > Arguably running code for foreign architectures through QEMU binfmt is
> > something of a hack.  Mandating that every package *must* be patched to
> > support it seems user-hostile.  I'm more in favor of dropping it on the
> > build farm =20
>=20
> Indeed it is weird we do not only compile packages natively on the build
> farm.

I'm sorry that my earlier analysis mentioned qemu at all.  qemu is not at f=
ault
at all.  The same happens if you run 32 bit code on 64 bit hosts without us=
ing
qemu!  Except for one case: i686 on x86_64--where they have a compatibility
layer in the kernel that works around this problem (which I don't like
either--it obfuscates the problem).

For example a problem appears on:

- armhf on x86_64 host; fault not because of qemu
- armhf on aarch64 host; not using qemu in the first place

And it should appear also on (but I didn't test):

- i686 on aarch64 host; not using qemu in the first place

The problem always appears if the host is 64 bits and the guest is 32 bits,
no matter what cpus both are, except for the case "i686 on x86_64".

--Sig_/ohbs4dDz2j4tVMjKeiMrOgB
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9vHPQACgkQ5xo1VCww
uqWN+gf6At1d5aYujggHx0tZ53zlU+hUN7ok+tj8Ea51tkjINPKEwPjcmbdGjAs5
5OyXLLBQe+v1nbltp7nTMsryQelqWnYpzEerGw4wuFI2q/SQ3N9ARy1YXmBitTlc
+7nlCkx798uIIEBF9VYJGcTCXd+WPh9O7lqYnhwIMxzPqXvxfnBWmvnBWloMIFx7
Uw+wm/j4jTaI/RFI8/AtotPRfVubqXQhAMagW1vfB/1q0qyy9+v/VvsMO3u7iaKQ
75QdHmGZ1bMKEi4AIpP046Hn6Z0R5rALPk+EG+nOXqXtyq0/N386gF9b+OrCoDjK
vtASqeg4hV5Ot9ApjfbQmHw6XEQUXA==
=Btl3
-----END PGP SIGNATURE-----

--Sig_/ohbs4dDz2j4tVMjKeiMrOgB--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 26 Sep 2020 01:49:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 21:49:39 2020
Received: from localhost ([127.0.0.1]:45552 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLzLG-0007se-Ti
	for submit <at> debbugs.gnu.org; Fri, 25 Sep 2020 21:49:39 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:36258)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLzLF-0007sW-G5
 for 43591 <at> debbugs.gnu.org; Fri, 25 Sep 2020 21:49:38 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 8AFA63368584;
 Sat, 26 Sep 2020 03:49:36 +0200 (CEST)
Date: Sat, 26 Sep 2020 03:49:12 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200926034912.6ad44194@HIDDEN>
In-Reply-To: <20200926034244.1aa3c4f6@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <20200925122004.38275411@HIDDEN>
 <20200925153646.6ef95908@HIDDEN>
 <20200926034244.1aa3c4f6@HIDDEN>
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_/9hTZstjLFB/FRcO=rhw.YPG";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/9hTZstjLFB/FRcO=rhw.YPG
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Sat, 26 Sep 2020 03:42:44 +0200
Danny Milosavljevic <dannym@HIDDEN> wrote:

> Hi,
>=20
> by now I also tested it on overdrive1, an aarch64 machine.
>=20
> > I do not have access to a real aarch64 machine--so no idea how it is th=
ere.
> > That would be the most interesting case, because those don't have X86_3=
2,
> > so ILP32 is either not present or implemented differently. =20
>=20
> I added it in the table below under "a64armhf".
>=20
> ILP32 is not present on aarch64.
>=20
> Test result of [1] updated:
>=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
> a64armhf -                 4 Byte  4 Byte         FAIL
> a64armhf 64                8 Byte  8 Byte         8 Byte
> a64armhf 32                4 Byte  4 Byte         FAIL
> a64armhf 7                 4 Byte  4 Byte         FAIL

aarch64    -                 8 Byte  8 Byte         8 Byte

> For a64armhf, the version with -D_FILE_OFFSET_BITS=3D64 is the only one w=
here
> readdir succeeds on my specially-prepared directory.


--Sig_/9hTZstjLFB/FRcO=rhw.YPG
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9unhgACgkQ5xo1VCww
uqX0kAf/aQdWX0rI6ewzOIgGflwtqpn+EX4XCuan4RCip2QINbbjNtkPyizeteKN
0cNwZryEmqfrzCoBiO9UpXIb+n4/pUQn2o8jW/s1x6UJJR1SmWiX4bE28SffOqtU
HOudY9tEgildMf2GJG5XJzJy3XVzvPig93ttsGwOL/CSmVm6/WiEw1n16SJW/O4H
jla3/solrbfLhppngE61fHciv4UhDsaoMi9b6GvXaz7frlBnLZ0eaTAYTf6cfe3f
LoxKnx0GpRwYLIIGpQHIBgDlqC9k0ZCo2fC86oMb+ZQg8RFe8oolhmzU4fZO1fZ6
Puyn6V1vMF9+l91oXoyQiSA9+POL6w==
=CB0G
-----END PGP SIGNATURE-----

--Sig_/9hTZstjLFB/FRcO=rhw.YPG--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 26 Sep 2020 01:43:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 21:43:46 2020
Received: from localhost ([127.0.0.1]:45548 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLzFa-0007jz-6X
	for submit <at> debbugs.gnu.org; Fri, 25 Sep 2020 21:43:46 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:35736)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLzFU-0007jj-D5
 for 43591 <at> debbugs.gnu.org; Fri, 25 Sep 2020 21:43:44 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 97F6A3368584;
 Sat, 26 Sep 2020 03:43:38 +0200 (CEST)
Date: Sat, 26 Sep 2020 03:42:44 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200926034244.1aa3c4f6@HIDDEN>
In-Reply-To: <20200925153646.6ef95908@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <20200925122004.38275411@HIDDEN>
 <20200925153646.6ef95908@HIDDEN>
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_/mjfZwQkYo41nr/pG_g/4=fo";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/mjfZwQkYo41nr/pG_g/4=fo
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi,

by now I also tested it on overdrive1, an aarch64 machine.

> 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.

I added it in the table below under "a64armhf".

ILP32 is not present on aarch64.

Test result of [1] updated:

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
a64armhf -                 4 Byte  4 Byte         FAIL
a64armhf 64                8 Byte  8 Byte         8 Byte
a64armhf 32                4 Byte  4 Byte         FAIL
a64armhf 7                 4 Byte  4 Byte         FAIL

For a64armhf, the version with -D_FILE_OFFSET_BITS=3D64 is the only one whe=
re
readdir succeeds on my specially-prepared directory.

--Sig_/mjfZwQkYo41nr/pG_g/4=fo
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9unJQACgkQ5xo1VCww
uqXawgf9H6G51A5PzxdtOgSuUilzwEULll2McSYirbJ5kKgXMNZjWESrpEfsCQsX
p68j23tSxTaInQi1uEBd+ye9Qrt5oQl0xCN14y3KIygb+m8SgC04yMS7Q2VgbhF9
7CSYqjXRb2zkB4OTMVPtFl8p04EcHZvBuFx0p2bCNXfFupPJ2ELRqnNIAht4fInW
JZnD7SYfrh39rBjLFeHIswyeH25LeFysvkGlpPbbL0ZX6Ku1RU/h+B6AXMWIriv4
04/10Qya1dlGVNY1qxShgWrvVTEJuAlZ+L6xg0DjkGbbedjU0cywwxIJybmgoWFY
K7nIC7zvm1DvHjEIzLm/0spCmCCf2A==
=BlIh
-----END PGP SIGNATURE-----

--Sig_/mjfZwQkYo41nr/pG_g/4=fo--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 25 Sep 2020 20:03:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 16:03:51 2020
Received: from localhost ([127.0.0.1]:45411 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLtwd-0008RY-LY
	for submit <at> debbugs.gnu.org; Fri, 25 Sep 2020 16:03:51 -0400
Received: from hera.aquilenet.fr ([185.233.100.1]:54454)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <andreas@HIDDEN>) id 1kLtwb-0008RH-RO
 for 43591 <at> debbugs.gnu.org; Fri, 25 Sep 2020 16:03:50 -0400
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 74983D9D;
 Fri, 25 Sep 2020 22:03:48 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id CgLVQG4HozmZ; Fri, 25 Sep 2020 22:03:47 +0200 (CEST)
Received: from jurong (unknown [IPv6:2001:910:103f::323])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 1B54C4FC;
 Fri, 25 Sep 2020 22:03:37 +0200 (CEST)
Date: Fri, 25 Sep 2020 22:03:23 +0200
From: Andreas Enge <andreas@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200925200323.GB5828@jurong>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87tuvm4vop.fsf@HIDDEN>
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>, 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

On Fri, Sep 25, 2020 at 01:11:18AM +0200, Marius Bakke wrote:
> Arguably running code for foreign architectures through QEMU binfmt is
> something of a hack.  Mandating that every package *must* be patched to
> support it seems user-hostile.  I'm more in favor of dropping it on the
> build farm

Indeed it is weird we do not only compile packages natively on the build
farm. If we do not have enough aarch64 machines, would it make sense to buy
some more? How many would we need? Which are our options of machines that
can run the GNU system (as opposed to Guix on a foreign distro, and possibly
non-free firmware)?

Andreas





Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 25 Sep 2020 15:34:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 11:34:33 2020
Received: from localhost ([127.0.0.1]:45105 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLpk1-0001wx-2s
	for submit <at> 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 <dannym@HIDDEN>) id 1kLpjv-0001wj-OD
 for 43591 <at> 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 <dannym@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200925173320.593e9179@HIDDEN>
In-Reply-To: <20200925153646.6ef95908@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <20200925122004.38275411@HIDDEN>
 <20200925153646.6ef95908@HIDDEN>
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-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--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--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 25 Sep 2020 13:37:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 09:37:44 2020
Received: from localhost ([127.0.0.1]:43061 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLnux-0000gX-Od
	for submit <at> debbugs.gnu.org; Fri, 25 Sep 2020 09:37:43 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:54482)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLnuv-0000gO-R7
 for 43591 <at> debbugs.gnu.org; Fri, 25 Sep 2020 09:37:42 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 0A27433682F4;
 Fri, 25 Sep 2020 15:37:39 +0200 (CEST)
Date: Fri, 25 Sep 2020 15:36:46 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200925153646.6ef95908@HIDDEN>
In-Reply-To: <20200925122004.38275411@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN> <20200925122004.38275411@HIDDEN>
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_/9ibAGn0cyY4gCY7.bZl8l_y";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/9ibAGn0cyY4gCY7.bZl8l_y
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

> >Why is this not an issue with i686 on x86_64 kernels? =20
>=20
> I'm not sure.  I'll check.

$ cat a00.c
#include <stdio.h>
#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 a00=
.c
a00.c:3:2: warning: #warning ILP32 [-Wcpp]
    3 | #warning ILP32
      |  ^~~~~~~
$ ./a00
$ echo $?
4

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_off.

$ 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

That is why __i686__ is not affected--at the cost of the kernel lying to us
about the file system.

Note that I also tried printing the actual d_off values[1]--on ILP32, even =
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_BITS=
=3D64.

(I also tried printing the actual d_off values[1] on x86_64 without any guix
environment -s, I get entirely different d_off values!!)

I also tried the former on native ARMHF--you get 32 bits d_off values.  And=
 d_off
is always the same size as off_t.

off_t size changes depending on _FILE_OFFSET_BITS.

I do not have access to a real aarch64 machine--so no idea how it is there.
That would be the most interesting case, because those don't have X86_32,
so ILP32 is either not present or implemented differently.

ppc64 would also be interesting...

Test result of [1]:

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

This is all without qemu--in order to simplify the test case.

So I take it ext4 has some special compilation mode for 32 bits...

Could someone please test [1] on (real!) aarch64 and ppc64 and ppc32
machines?

[1] $ cat a00.c=20
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <dirent.h>
#if defined( __ILP32__ )
#warning ILP32
#endif

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);

--Sig_/9ibAGn0cyY4gCY7.bZl8l_y
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9t8m4ACgkQ5xo1VCww
uqWmVQf9Gy9Y5HXJyFlOOnywiaIBQuhAmEry1kSYKv0CEwwlZDsMmNyYbKZeMtMS
AY5mw0zxZ215+47xTDqys5GOKKn6Iq6DgVw96Ts+sig945Crw52Aey/XIzrGrEaM
9sJ7xIIcLZuBUlOye9QtctB7tgDhCw9afjKfkB4nwnvPP3H6c+sOIcZiEH4OY3VQ
3xN40ErTBY+PovHojfvdiKy/7spTibocYxC5xWOaAXBIkaP6Xj1m7ySk96A4WF/8
WycJHuSsrVn/QEbens03akkCeME0ZDVZkQd0O12FZ3zL01aNB7EBZa3vjGxkcWSM
H4oBddMV8VfQ2CzJeK4nsNz8FmFU2Q==
=14ua
-----END PGP SIGNATURE-----

--Sig_/9ibAGn0cyY4gCY7.bZl8l_y--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 25 Sep 2020 10:43:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 06:43:21 2020
Received: from localhost ([127.0.0.1]:42793 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLlCD-0006gl-Dr
	for submit <at> debbugs.gnu.org; Fri, 25 Sep 2020 06:43:21 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:38540)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLlCB-0006gd-VZ
 for 43591 <at> debbugs.gnu.org; Fri, 25 Sep 2020 06:43:20 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 1C9493365A25;
 Fri, 25 Sep 2020 12:43:18 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: [PATCH v2 core-updates] gnu: glibc-final: Catch all cases of a glibc
 user not requesting 64-bit offsets and then using readdir regardless.
Date: Fri, 25 Sep 2020 12:42:43 +0200
Message-Id: <20200925104243.2298-1-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200925122004.38275411@HIDDEN>
References: <20200925122004.38275411@HIDDEN>
MIME-Version: 1.0
Tags: patch
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* gnu/packages/commencement.scm (glibc-final): Catch all cases of a glibc user not
requesting 64-bit offsets and then using readdir.
---
 gnu/packages/commencement.scm | 68 ++++++++++++++++++++++++++++++++++-
 1 file changed, 67 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index e5a4caa95c..284fa65d20 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3462,7 +3462,73 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                ,hurd-headers-boot0)
              '())
        ,@(package-outputs glibc-final-with-bootstrap-bash))
-      ,@(package-arguments glibc-final-with-bootstrap-bash)))))
+      ,@(substitute-keyword-arguments
+         (package-arguments glibc-final-with-bootstrap-bash)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'patch-dirent
+               (lambda* (#:key outputs #:allow-other-keys)
+                 ;; Linux kernel file offsets are always 64 bits.
+                 ;; But userspace can be built to use 32 bit offsets.
+                 ;;
+                 ;; "struct dirent", returned by readdir, uses d_off to store
+                 ;; such an "offset" that it got from the Linux kernel.
+                 ;; In the case of ext4 that "offset" is actually a 64 bit
+                 ;; cookie which includes a hash value.
+                 ;;
+                 ;; Therefore, there are cases where such an offset that it got
+                 ;; from the Linux kernel does not fit in the "struct dirent"
+                 ;; field "d_off".
+                 ;;
+                 ;; If the guest system's glibc is 32 bit AND uses 32 bit
+                 ;; file offsets it is going to be very confused.
+                 ;; It does check whether d_off fits into the structure
+                 ;; it gives back to the user--and it doesn't fit.  Hence readdir
+                 ;; fails, with errno == EOVERFLOW (which is undocumented and thus
+                 ;; an API error).
+                 ;; This manifests itself in simple directory reads not working
+                 ;; anymore in parts of cmake, for example.
+                 ;;
+                 ;; This manifested in Guix when building stuff for
+                 ;; ARMHF on a x86_64 build host using QEMU transparent emulation.
+                 ;;
+                 ;; There is a very simple and complete way to avoid this problem:
+                 ;; Just always use 64 bit offsets in user space programs (also
+                 ;; on 32 bit machines).  The Linux kernel does that already
+                 ;; anyway.
+                 ;;
+                 ;; Note: We might want to avoid using 64 bit when bootstrapping
+                 ;; using mescc (since mescc doesn't directly support 64 bit
+                 ;; values)--but then bootstrapping has to be done on a
+                 ;; file system other than ext4, or on ext4 with the feature
+                 ;; "dir_index" disabled.
+                 ;;
+                 ;; The change below does not affect 64 bit users.
+                 ;;
+                 ;; See <https://issues.guix.gnu.org/43513>.
+                 (let ((port (open-file "dirent/dirent.h" "a")))
+                   (display "
+#ifndef _LIBC
+#if __SIZEOF_LONG__ < 8
+#ifndef __USE_FILE_OFFSET64
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 32
+#warning \"Using -D_FILE_OFFSET_BITS=32 and using readdir is a bad idea, see <https://bugzilla.kernel.org/show_bug.cgi?id=205957>\"
+#else
+#undef readdir
+#define readdir @READDIR_WITHOUT_FILE_OFFSET64_IS_A_REALLY_BAD_IDEA@
+#endif
+#endif
+#endif
+#endif
+" port)
+                   (close-port port))
+                 ;; This file includes <dirent.h> and thus checks sanity already.
+                 ;; TODO: Check dirent/scandir-tail.c, dirent/scandir64-tail.c.
+                 (substitute* "posix/glob.c"
+                  (("(#[ ]*define[ ][ ]*readdir)") "
+#undef readdir
+#define readdir"))
+                 #t)))))))))
 
 (define/system-dependent gcc-boot0-wrapped
   ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 25 Sep 2020 10:25:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 06:25:16 2020
Received: from localhost ([127.0.0.1]:42771 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLkui-00045x-K2
	for submit <at> debbugs.gnu.org; Fri, 25 Sep 2020 06:25:16 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:37002)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLkug-00045o-Jw
 for 43591 <at> debbugs.gnu.org; Fri, 25 Sep 2020 06:25:14 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id E265833682CD;
 Fri, 25 Sep 2020 12:25:13 +0200 (CEST)
Date: Fri, 25 Sep 2020 12:24:50 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200925122450.61df97da@HIDDEN>
In-Reply-To: <87363759at.fsf@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN>
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_/runeDaZWPexcnwMWnD+cTOb";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/runeDaZWPexcnwMWnD+cTOb
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Thu, 24 Sep 2020 20:17:14 +0200
Marius Bakke <marius@HIDDEN> wrote:

> As mentioned in that issue, and which this patch states on no uncertain
> terms, a workaround is to use -D_FILE_OFFSET_BITS=3D64 on 32-bit platform=
s.

That is not a workaround.  That is the correct fix.

The kernel uses 64 bit offsets on 32-bit platforms anyway.

So either they don't ask the kernel questions they don't want to know the
answer to, or they use 64 bit offsets, too.

--Sig_/runeDaZWPexcnwMWnD+cTOb
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9txXIACgkQ5xo1VCww
uqWFxgf/SFs4Qr2DuOGjlo/8lwAeGFPdnAWlun5d8yEeBcQCOnxPIi/XjeJNryM2
+T/81IBsByMIZlQWPPssYsFgqAqpPh4jG0ymYc77f3mJ4a4vqHzvbM7CWYRpxFO8
WBv42TsOl1szwOrwknF/Qqx7ERv2hNidkzCmqrAaOtnu5aLCrmdWX/UmeZkEZYJG
gTQUKOdhgUQTfJgzW9RbdeN/TmJRsfsQZGzq+65BFDg9HERU/LhtR5E704HmRiZx
lmmHR1ArysoEvhioX6aqaQxkFFgCeTn0IXtmSpaHZSsFHrsl7LAWx4V8DcOaAF8E
upmivdcdHAKPP6ULiRKpsYzceAwHPw==
=YvvO
-----END PGP SIGNATURE-----

--Sig_/runeDaZWPexcnwMWnD+cTOb--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 25 Sep 2020 10:21:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 25 06:21:02 2020
Received: from localhost ([127.0.0.1]:42763 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLkqb-0003uS-Vr
	for submit <at> debbugs.gnu.org; Fri, 25 Sep 2020 06:21:02 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:36630)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLkqZ-0003tz-01
 for 43591 <at> debbugs.gnu.org; Fri, 25 Sep 2020 06:21:00 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 4954F33682CD;
 Fri, 25 Sep 2020 12:20:57 +0200 (CEST)
Date: Fri, 25 Sep 2020 12:20:04 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200925122004.38275411@HIDDEN>
In-Reply-To: <87tuvm4vop.fsf@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
 <87tuvm4vop.fsf@HIDDEN>
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_/.UThJ_OqIlDjljxsYSUzUuS";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/.UThJ_OqIlDjljxsYSUzUuS
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi Marius,

On Fri, 25 Sep 2020 01:11:18 +0200
Marius Bakke <marius@HIDDEN> wrote:

> Arguably running code for foreign architectures through QEMU binfmt is
> something of a hack.

The problem here is not qemu.  It's not even the size of the whole struct
dirent that's the problem, or endianness, or alignment, or any of that stuf=
f.

The problem is that if you have a 64-bit hash value then you can't fit it i=
nto
a 32-bit field.

You have to make the field bigger.

It's the only non-insane way to fix this and still be able to use the host
filesystem from the guest.

This bug is making readdir randomly and silently succeed or fail.

Note: The bug I'm referring to is caused by having 32 bit offsets in user s=
pace
in the first place--nothing else.  That is the root of the problem, not qem=
u,
not ext4, not the kernel.  Having 32 bit offsets in user space when kernel =
space
uses 64 bit offsets is just weird (note: the kernel always uses 64 bit
offsets--also on 32 bit architectures!).

Note: This also affects 9p, which has been recently "fixed" in the Linux ke=
rnel.

>Why is this not an issue with i686 on x86_64 kernels?

I'm not sure.  I'll check.

>Or armhf on AArch64?

I cannot check that, but it totally should be a problem there.

It has nothing to do with qemu specifically, and IMO qemu is right in not
"fixing" it (because it's NOT a problem in qemu), and in expecting
32 bit guests not to use the getdents64 system call :P

But even using getdents (no 64) as a flag what size d_off the caller
expects is an ugly workaround.
Not because of the flag, but because of what you have to do if it's set.

The right fix is to switch to LFS (and thus also 64 bit d_off) on 32 bit gu=
ests.
It's 2020; normal systems have drives a lot bigger than 4 GiB.  Even Raspbe=
rrys
have bigger drives.

Also, just for the record, glibc always calls getdents64, never getdents.
Using getdents64 and then being surprised when a 64 bit result comes back is
seriously weird.  And they are still defending it!

If they didn't do that, at least the kernel would know something is up,
and qemu would still pass through getdents as getdents to the host kernel a=
nd
getdents64 as getdents64 to the host kernel.  Also, qemu could warn on calls
to getdents (and not on calls to getdents64).

There are no downsides to knowing what the user expects.

But even then, user space probably would have LFS disabled.  That means
as soon as user space mounts something from NFS or 9p or whatever on their
(let's say embedded) platform, they would have this problem again,
and it would be very difficult to find what happened.  Why keep this problem
alive?

>This problem only manifests when using QEMUs syscall emulation, right?

No.

It's a fundamental problem with the slot you want to store something in
being too small for it.

We just didn't see it yet, because usually the system *silently returns* ha=
lfway
through the readdir loop and does not tell us about any problems once it
encounters any d_off >=3D 2**32 along the way.

In the "json-c" bug, luckily json-c or cmake actually NEEDED a file that had
not been returned because of that.  That is not a given.

>Mandating that every package *must* be patched to support it seems user-ho=
stile.

Ok, then how about a flag that users can set in order to let it compile
regardless?  But then they shouldn't use that flag in any (non-cross-compil=
ed)
guix packages.
We can mention it in the news so people are not surprised.
(Thinking about it, the flag could just be "-D_FILE_OFFSET_BITS=3D32".  Bec=
ause
when you are setting it explicitly, you probably know what you are doing)

It really depends on whether we officially support running 32 bit guests
on 64 bit hosts.  Qemu has nothing to do with it.

Since the majority of our build farm runs qemu transparent emulation, and
since a majority of our ARM packages are built using it, it seems that we
decided to support 32 bit guests on 64 bit hosts.  Well, then something like
this patch has to be done, otherwise we have Schr=C3=B6dinger's build syste=
m--and
no one likes that.

(I want to stress that the main problem is the case where readdir SUCCEEDS
even though there is a problem;
if readdir would always fail in the situation with a 32 bit guest on
64 bit host, that would be much less bad.  But it doesn't always fail!)

I'd be really uneasy if the sanity check this patch introduces were only
enabled when explicitly setting a flag--for something as bad as this.

Especially for an error that silently makes it into base derivations and th=
en
distributes all the way to who-knows-what normal client derivations.

Keeping the user from shooting himself in the foot by default if he doesn't
say "yes, please shoot me in the foot" beforehand is not "user-hostile".

We could also do a deprecation warning instead:

struct dirent* readdir(DIR* d) __attribute__((deprecated("Unsafe if not usi=
ng large file support")));

f1.c:5:2: warning: 'readdir' is deprecated: Unsafe if not using large file =
support [-Wdeprecated-declarations]

But then the warning would not be emitted in the, for example, json-c packa=
ge,
but in cmake.  I would never have found the bug that way.  I guess now we
know, but still... only emitting a warning seems weak for something this ba=
d.

So I'm against it.

>  I'm more in favor of dropping it on the
> build farm,

>or just keep fixing things on a per-package basis.

That means you have to *find* the things first.  The only reason glibc found
the problem this one time is because the d_off telldir pointer just happened
to be >=3D 2**32.  If it's not bigger one time, and is bigger another time =
in
the same package build run, then you get weird unreproducible results.

That is horrible.  A copy-recursively could leave half the files off and not
tell anyone.  PLEASE let's do something about it.  Also, let's delete all
our ARM substitutes we have so far.

> A less user-hostile solution could perhaps be to (setenv "CFLAGS"
> "-D_FILE_OFFSET_BITS=3D64") on 32-bit architectures in gnu-build-system.

Sure, we can definitely do that in addition.  It's a good idea.  There can
be no ABI compatibility problem inside Guix if *all* Guix packages use that
flag.

While we are at it, we can do it on ALL architectures.  Because that's what
we actually want.  Should there be a 128 bit CPU, we still want all CPUs
(no matter how many bit registers the CPU has) use the same file offset
bit size.

But will that be picked up everywhere?  cmake?  Rust C extensions?  Python
extensions?

> Not sure whether that could cause any adverse effects.

It will.  And if we want to find out where those effects would be, this
patch--or one with warnings (that one is only useful if there is a way to
automatically collect AND KEEP all warnings into one place)--is how to find
out.

>  But again, I don't like the idea of optimizing for QEMUs user-mode emula=
tion.

It's not optimizing for qemu specifically.  Qemu is not at fault here.
(guest) glibc is at fault.  Because of the way we build it.

I've thought through a few possible fixes for this problem:

(1) Wait until the kernel adds a "I-have-space-for-x-bits" field to the
getdents64 system call and for qemu to actually use it.  But how would qemu
know how much space the guest glibc has in its field?
But fine, let's say they have a crystal ball.  Even then, what is ext4 going
to do with this request?  Just cut the cookie somewhere and throw away half?
That's not safe.  So this solution is right out.

(2) Have glibc use getdents on 32 bit and getdents64 on 64 bit.  See above-=
-only
now qemu can tell know much space the guest glibc has, and so can the host =
kernel
(which is much better).
Cutting the cookie is not safe.  So this solution is still out, barely.

(3) Have qemu maintain a mapping table per file of which 64-bit d_off is
associated with which weird cookie qemu invents and remembers.

That doesn't help us in the case where you DO NOT USE qemu but still have
a 32 bit executable running on a 64 bit host (natively).

Therefore, this solution is out.

(4) Build user space with large file support.  There are no downsides to th=
is,
and as a distribution we can indeed decide only to support large file guix
packages.  I argue that this is the right solution for all "Guix system" ho=
sts,
because of the "SD card" argument above.  Also, directories with Guix on it
aren't exactly small either.  So you need it anyway.  If there are embedded
platforms with disks smaller than 4 GiB used in guix, we can given those
glibcs an original dirent.h (they will fail loudly--so we will find them ea=
sily).

I prefer this solution.

(5) Build the qemu that emulates 32 bit ARM for 32 bit i686 (this is not a =
typo).
In that case the kernel would enable compatibility mode (X86_32 personality=
) and
it would work.  I want to stress that this compatibility mode calculates
different hashes depending on the program that is requesting it, on the
same host, directory and entry.  This is not something one would want,
especially when building things--the kernel is basically lying to you.
See kernel option CONFIG_X86_32--which we enable.

It would work okay in practice, because user space programs usually don't s=
tore
d_off.  But (4) is just better.

P.S. by now, my local build found a binutils 2.35.1 bfd plugin, and
(libstdc++-v3/src/filesystem/dir.cc in) libstdc++ 7.5.0, that also don't use
large files and thus would also only work sporadically in random ways.

How many hundreds of packages does this affect that we don't know yet?

PPS. I get a lot of "grep: invalid option -o" messages when building
glibc-2.32--even without the patch.  That's probably not good either.

PPPS. new patch will come soon.

--Sig_/.UThJ_OqIlDjljxsYSUzUuS
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9txFQACgkQ5xo1VCww
uqWCSwf/WwR2WWHPz4kO0hVdcEjmjMTwarKs1VF5DNs+pA6WwVN5nB2Nyp5El4mV
wwo4ik3BAzOicLBHwNYk6H+/RINRqFrtDqHUkC6dRo3zXzhmtgXSs2PajYie2ljr
eviZNBmZcwGdEitvv6E/9+K4fbDIIG6rhygWiY/x9YD+3/mdw8eTJ5Km1tnjCSZ4
uPT7CiWB43LuValm7R9k034N/dgix8bT8QTgLPQ25X7bhII1sX6Xs33d20eLCDen
cD1pKmcCvbVgh5ZGsG8BI7Lcp86AfUvfOVlZZlwNIFvSVS9DUMJ23sCiL48GGFV8
FYUb2ZvPyFdP60JzPykH/PlpTXg8nA==
=eqNk
-----END PGP SIGNATURE-----

--Sig_/.UThJ_OqIlDjljxsYSUzUuS--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 24 Sep 2020 23:11:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 24 19:11:33 2020
Received: from localhost ([127.0.0.1]:41993 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLaOj-0000El-Ct
	for submit <at> debbugs.gnu.org; Thu, 24 Sep 2020 19:11:33 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57506)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <marius@HIDDEN>) id 1kLaOe-0000EV-OI
 for 43591 <at> debbugs.gnu.org; Thu, 24 Sep 2020 19:11:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:42922)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <marius@HIDDEN>)
 id 1kLaOY-0007yp-RZ; Thu, 24 Sep 2020 19:11:22 -0400
Received: from ti0006q161-3115.bb.online.no ([88.95.106.80]:42864
 helo=localhost)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <marius@HIDDEN>)
 id 1kLaOX-0003cp-DI; Thu, 24 Sep 2020 19:11:22 -0400
From: Marius Bakke <marius@HIDDEN>
To: Danny Milosavljevic <dannym@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
In-Reply-To: <20200924222711.2f22281a@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN> <20200924222711.2f22281a@HIDDEN>
Date: Fri, 25 Sep 2020 01:11:18 +0200
Message-ID: <87tuvm4vop.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Danny Milosavljevic <dannym@HIDDEN> writes:

> Hi Marius,
>
> On Thu, 24 Sep 2020 20:17:14 +0200
> Marius Bakke <marius@HIDDEN> wrote:
>
>> As mentioned in that issue, and which this patch states on no uncertain
>> terms, a workaround is to use -D_FILE_OFFSET_BITS=64 on 32-bit platforms.
>
> Yeah.  The problem is how to find all those places where we need to add it,
> and how to keep finding them as we maintain stuff (read: as upstream changes
> stuff).
>
>> Won't this break _everything_ that uses readdir() without 64-bit
>> offsets?
>
> That's the goal of that patch.  Because it won't work at runtime anyway, when
> run on a guix x86_64 build machine, building for ARM (which is the usual way
> we build stuff for ARM).

Why is this not an issue with i686 on x86_64 kernels?  Or armhf on
AArch64?  This problem only manifests when using QEMUs syscall
emulation, right?

> Maybe we can find out whether dirent.h is #included for compiling for one of
> the main Guix platforms (I prefer this latter solution, if possible).
>
> It's either that or we stop qemu transparent emulation on the build farm,
> because the result isn't reliable.  This time it was "caught" because of
> an overabundance of caution on behalf of the glibc people.  We won't be
> so lucky next time.

Arguably running code for foreign architectures through QEMU binfmt is
something of a hack.  Mandating that every package *must* be patched to
support it seems user-hostile.  I'm more in favor of dropping it on the
build farm, or just keep fixing things on a per-package basis.

A less user-hostile solution could perhaps be to (setenv "CFLAGS"
"-D_FILE_OFFSET_BITS=64") on 32-bit architectures in gnu-build-system.
Not sure whether that could cause any adverse effects.  But again, I
don't like the idea of optimizing for QEMUs user-mode emulation.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl9tJ5YACgkQoqBt8qM6
VPrAYQgAnI3/88H0lcjkCiUbehr3AmthzPh1jGgIFAxv0XL1+YoCqtsHWCScxMzF
IsNCSMo2cYGplTDbQNyb+vNy1nQrIZecGm2mE8G5kPKir/ofSb05pQckCy7xDONt
/KMOAByMtQEueIbemyr+PdXi5jpTR+pG/Ef2ZjvBDLO7Fl9ZlYgiQx9V6vIjaikI
OWYRzanDMZkLB97DoM6lAAdtSMeSxbDj2n64rbxTdlVBnnrdagereSwWVpsNCeF4
k/z1isflAZxAiPWatsHoOmNPIxqGuPuytrNleHha4xVBEZn7ombTHeRI3qyYScWD
K0owVdK6pO+PUxiG2hzLq5dPmRI2LQ==
=aEhD
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 24 Sep 2020 20:28:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 24 16:28:20 2020
Received: from localhost ([127.0.0.1]:41902 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLXqm-0002iC-0d
	for submit <at> debbugs.gnu.org; Thu, 24 Sep 2020 16:28:20 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:48392)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLXqi-0002i2-P3
 for 43591 <at> debbugs.gnu.org; Thu, 24 Sep 2020 16:28:19 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id E5E8D33683B3;
 Thu, 24 Sep 2020 22:28:14 +0200 (CEST)
Date: Thu, 24 Sep 2020 22:27:11 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: Marius Bakke <marius@HIDDEN>
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200924222711.2f22281a@HIDDEN>
In-Reply-To: <87363759at.fsf@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
 <87363759at.fsf@HIDDEN>
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_/M0w0kB1M+f=1_ZOjx/uuh5R";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
Cc: 43591 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/M0w0kB1M+f=1_ZOjx/uuh5R
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi Marius,

On Thu, 24 Sep 2020 20:17:14 +0200
Marius Bakke <marius@HIDDEN> wrote:

> As mentioned in that issue, and which this patch states on no uncertain
> terms, a workaround is to use -D_FILE_OFFSET_BITS=3D64 on 32-bit platform=
s.

Yeah.  The problem is how to find all those places where we need to add it,
and how to keep finding them as we maintain stuff (read: as upstream changes
stuff).

> Won't this break _everything_ that uses readdir() without 64-bit
> offsets?

That's the goal of that patch.  Because it won't work at runtime anyway, wh=
en
run on a guix x86_64 build machine, building for ARM (which is the usual way
we build stuff for ARM).

Maybe we can find out whether dirent.h is #included for compiling for one of
the main Guix platforms (I prefer this latter solution, if possible).

It's either that or we stop qemu transparent emulation on the build farm,
because the result isn't reliable.  This time it was "caught" because of
an overabundance of caution on behalf of the glibc people.  We won't be
so lucky next time.

>  Or does that @@ string get substituted by the glibc build
> system somehow.

No.  It's specifically made so downstream users of glibc on guix can't use
readdir() on 32-bit systems without enabling large file support.

It totally could use some more #if about whether it's building stuff for
an actual guix main platform (i.e. not on embedded).

> Can you file a bug report upstream about the duplicate definition(s)?

It's not really a problem for them.  But I can try anyway.

> Enforcing this restriction in glibc feels rather sledgehammer-y.  Would
> it make sense to introduce a GCC warning instead?  I'm sure there are
> legitimate uses of smaller file offsets (i.e. embedded).  A GCC warning
> will still break -Werror, but that's a lot more manageable than breaking
> almost every use of readdir() on 32-bit platforms.

I thought about a gcc #warning.  But I don't want it to warn when readdir
isn't used in the first place but dirent.h ended up being included by some
dependency.  I guess we could use a deprecation warning on readdir() instea=
d.
Can this warning print a custom message?

What do you think?

In any case, I'd like to have some overview of how bad the problem is and
thus I'd like to have a wip branch with this patch being built entirely
for 32 bits via x86_64 (not sure whether that includes i686 btw).
Is it possible to force using these x86_64 machines in the build farm?

>I'm sure there are legitimate uses of smaller file offsets (i.e. embedded).

On guix?  With our glibc?  Do we support that?

>A GCC warning will still break -Werror, but that's a lot more manageable
>than breaking almost every use of readdir() on 32-bit platforms.

These uses of readdir() are not reliable the way we are building guix on
cuirass.

But I'm all for refining this patch, if there are suggestions on how.

Actually, I think a warning is not strong enough.  This bug made it all the
way down to json-c (!) before finally being detected.  That should not happ=
en.

And if the build farm would have selected an actual ARM machine, the build
would have succeeded and no one on x86_64 could have reproduced the result.
That would have been real bad.

--Sig_/M0w0kB1M+f=1_ZOjx/uuh5R
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9tAR8ACgkQ5xo1VCww
uqUQqAgAhPm5IvAyqQ+RtKLzcd/JTSlzR8/lbc6RVhuea0/IiYZJHjFKcY9YTbWs
3c9Rvk0zI8XvzXs8ViLqVRwMDf+fFW/KBFKWgkyfpF784T12m/4epJE/3s4v1ihy
UC1WGxS5xTs2PkXcL9aG+FpwV+5zMROV7ge4he0wGJUnB1BtkvYh3PWzVoqeM1Wt
+M8I0anOi7NLc3EHWJDCv+RjcRrI1f2HBXlWprc6rxBGnVpRJrtHZSQHrUrTOQF1
IB8YK12qB6FbDy/DZDaMwLiY4x+sonKQ1+CTJkkG6irJ+Xh/MtHgNj9rWVOXzsCE
3RG3MNjdAx3o/08r262LrNxRFITu1w==
=9PzS
-----END PGP SIGNATURE-----

--Sig_/M0w0kB1M+f=1_ZOjx/uuh5R--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 24 Sep 2020 18:17:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 24 14:17:28 2020
Received: from localhost ([127.0.0.1]:41677 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLVo7-0003m8-Sq
	for submit <at> debbugs.gnu.org; Thu, 24 Sep 2020 14:17:28 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56592)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <marius@HIDDEN>) id 1kLVo6-0003lw-IU
 for 43591 <at> debbugs.gnu.org; Thu, 24 Sep 2020 14:17:27 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:38398)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <marius@HIDDEN>)
 id 1kLVnz-0005yO-6U; Thu, 24 Sep 2020 14:17:19 -0400
Received: from [195.18.146.5] (port=49622 helo=localhost)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <marius@HIDDEN>)
 id 1kLVnw-00005K-Hi; Thu, 24 Sep 2020 14:17:17 -0400
From: Marius Bakke <marius@HIDDEN>
To: Danny Milosavljevic <dannym@HIDDEN>, 43591 <at> debbugs.gnu.org
Subject: Re: [bug#43591] [PATCH core-updates] gnu: glibc-final: Catch all
 cases of a glibc user not requesting 64-bit offsets and then using readdir.
In-Reply-To: <20200924141211.21649-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
Date: Thu, 24 Sep 2020 20:17:14 +0200
Message-ID: <87363759at.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43591
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Danny Milosavljevic <dannym@HIDDEN> writes:

> +                 ;; QEMU transparent emulation is in somewhat of a pickle sometimes.
> +                 ;; There is no support in the kernel syscalls of specifying what
> +                 ;; kind of userspace you are emulating.  Some parts of the
> +                 ;; structures passed back-and-forth between kernel and guest
> +                 ;; userspace can change size (including size of individual fields).
> +                 ;;
> +                 ;; One of the affected structures is "struct dirent".  The ext4
> +                 ;; file system puts a 64 bit hash into "d_off" on the kernel side.
> +                 ;; If the guest system's glibc is 32 bit it is going to be very
> +                 ;; confused (it does check whether d_off fits into the structure
> +                 ;; it gives back to the user--and it doesn't fit.  Hence readdir
> +                 ;; fails).
> +                 ;; This manifests itself in simple directory reads not working
> +                 ;; anymore in parts of cmake, for example.

Note that for CMake in particular, this problem will be fixed in 3.19:

  https://gitlab.kitware.com/cmake/cmake/-/issues/20568

As mentioned in that issue, and which this patch states on no uncertain
terms, a workaround is to use -D_FILE_OFFSET_BITS=64 on 32-bit platforms.

> +                 ;;
> +                 ;; There is a very simple and complete way to avoid this problem:
> +                 ;; Just always use 64 bit offsets in user space programs (also
> +                 ;; on 32 bit machines).
> +                 ;;
> +                 ;; Note: We might want to avoid using 64 bit when bootstrapping
> +                 ;; using mescc (since mescc doesn't directly support 64 bit
> +                 ;; values)--but then bootstrapping has to be done on a
> +                 ;; file system other than ext4, or on ext4 with the feature
> +                 ;; "dir_index" disabled.
> +                 ;;
> +                 ;; The change below does not affect 64 bit users.
> +                 ;;
> +                 ;; See <https://issues.guix.gnu.org/43513>.
> +                 (let ((port (open-file "include/dirent.h" "a")))
> +                   (display "
> +#if __SIZEOF_LONG__ < 8
> +#ifndef __USE_FILE_OFFSET64
> +#undef readdir
> +#define readdir @READDIR_WITHOUT_FILE_OFFSET64_IS_A_REALLY_BAD_IDEA@

Won't this break _everything_ that uses readdir() without 64-bit
offsets?  Or does that @@ string get substituted by the glibc build
system somehow.

> +#endif
> +#endif
> +" port)
> +                   (close-port port))
> +                 ;; This file includes <dirent.h> and thus checks sanity already.
> +                 ;; TODO: Check dirent/scandir-tail.c, dirent/scandir64-tail.c.
> +                 (substitute* "posix/glob.c"
> +                  (("(#[ ]*define[ ][ ]*readdir)") "
> +#undef readdir
> +#define readdir"))

Can you file a bug report upstream about the duplicate definition(s)?

Enforcing this restriction in glibc feels rather sledgehammer-y.  Would
it make sense to introduce a GCC warning instead?  I'm sure there are
legitimate uses of smaller file offsets (i.e. embedded).  A GCC warning
will still break -Werror, but that's a lot more manageable than breaking
almost every use of readdir() on 32-bit platforms.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl9s4qoACgkQoqBt8qM6
VPov8QgA0GUVhmZGcGVhQFYtqMUxfLovkbh6OJXKx8eoByy+lNBK1x3cxsukQoob
wRA012R82QMpfOpDTSuKh3WSJDnj2c8x1ZRMKNNjQ3uVd1wvahgeuySdU9zSJTm8
WkM9TVVnhEj80OL94Zqzx7R5guXW/GjMZCmMuS3WiflEwsRf25mtifTIP0QcXoKf
/6NkM2oHQSBmMMimRFmRBcRhW8r+sVK9Mkrbz4OWxiiwRKe7LZoFLRszRkRGtCux
6hWkhxQeqizCuUoXdRDHTXT7kp6xSOEYBK1trMNGLNf+92UUjrhntgyNE573cmEy
nKWxW7qJJkx8AOjqubL5NAqf60TW7w==
=Joa2
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at 43591 <at> debbugs.gnu.org:


Received: (at 43591) by debbugs.gnu.org; 24 Sep 2020 14:16:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 24 10:16:32 2020
Received: from localhost ([127.0.0.1]:41129 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLS2y-0001kl-G7
	for submit <at> debbugs.gnu.org; Thu, 24 Sep 2020 10:16:32 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:42594)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLS2x-0001kd-DN
 for 43591 <at> debbugs.gnu.org; Thu, 24 Sep 2020 10:16:31 -0400
Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id C004F336819A
 for <43591 <at> debbugs.gnu.org>; Thu, 24 Sep 2020 16:16:30 +0200 (CEST)
Date: Thu, 24 Sep 2020 16:16:07 +0200
From: Danny Milosavljevic <dannym@HIDDEN>
To: 43591 <at> debbugs.gnu.org
Subject: Re: [PATCH core-updates] gnu: glibc-final: Catch all cases of a
 glibc user not requesting 64-bit offsets and then using readdir.
Message-ID: <20200924161607.0c196f98@HIDDEN>
In-Reply-To: <20200924141211.21649-1-dannym@HIDDEN>
References: <20200924141211.21649-1-dannym@HIDDEN>
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_/46f.RGkQSEs4g1bQkooID.Y";
 protocol="application/pgp-signature"; micalg=pgp-sha512
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43591
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/46f.RGkQSEs4g1bQkooID.Y
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Thu, 24 Sep 2020 16:12:11 +0200
Danny Milosavljevic <dannym@HIDDEN> wrote:
> +                 ;; Note: We might want to avoid using 64 bit when boots=
trapping
> +                 ;; using mescc (since mescc doesn't directly support 64=
 bit
> +                 ;; values)--but then bootstrapping has to be done on a
> +                 ;; file system other than ext4, or on ext4 with the fea=
ture
> +                 ;; "dir_index" disabled.

Or on a real 32 bit machine, where there is no problem with mismatching str=
uct
sizes between emulated guest glibc and host system kernel, because there is=
 no
emulation going on.

--Sig_/46f.RGkQSEs4g1bQkooID.Y
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9sqicACgkQ5xo1VCww
uqXO7wf+MGIbf5TXP6EEZ+ay4VWLji+EfEdvvv37LSSvlGBtAIyDY2spjc2dcvcd
yBA8o04jMes+JyCFWTpkZxbk5uwpEQxlSbmxtBtnjLnK7+1txVzweONiP590AMa2
9SApQbqpTr6mJrdLuaX+ATU54XXqAQ/Ah+wHWwoFeSk7catsAmhIEIOcbWB1zOMO
G+Mf+xR1l3GInukjUm3FvtJfHFd5B9nzgLeDKXeboXKdSvL90Hm5LYgIDxQkQ8J+
Iua9O5XPR200M4UMfkJVuD+clLP3bt63qmFUE/Z557woIqeA7l6lY4ee8kf8ylR1
Y8piTqrroEewYjqC1/xqCtXOB8Gliw==
=6+cv
-----END PGP SIGNATURE-----

--Sig_/46f.RGkQSEs4g1bQkooID.Y--




Information forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Sep 2020 14:12:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 24 10:12:41 2020
Received: from localhost ([127.0.0.1]:41120 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kLRzF-0001dt-L1
	for submit <at> debbugs.gnu.org; Thu, 24 Sep 2020 10:12:41 -0400
Received: from lists.gnu.org ([209.51.188.17]:45812)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dannym@HIDDEN>) id 1kLRzD-0001dj-8g
 for submit <at> debbugs.gnu.org; Thu, 24 Sep 2020 10:12:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:54508)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dannym@HIDDEN>)
 id 1kLRzD-0000qw-1H
 for guix-patches@HIDDEN; Thu, 24 Sep 2020 10:12:39 -0400
Received: from dd26836.kasserver.com ([85.13.145.193]:58664)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dannym@HIDDEN>)
 id 1kLRzA-0001i1-F6
 for guix-patches@HIDDEN; Thu, 24 Sep 2020 10:12:38 -0400
Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at
 [80.110.126.103])
 by dd26836.kasserver.com (Postfix) with ESMTPSA id 062F3336819A;
 Thu, 24 Sep 2020 16:12:33 +0200 (CEST)
From: Danny Milosavljevic <dannym@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH core-updates] gnu: glibc-final: Catch all cases of a glibc
 user not requesting 64-bit offsets and then using readdir.
Date: Thu, 24 Sep 2020 16:12:11 +0200
Message-Id: <20200924141211.21649-1-dannym@HIDDEN>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Tags: patch
Content-Transfer-Encoding: 8bit
Received-SPF: none client-ip=85.13.145.193;
 envelope-from=dannym@HIDDEN; helo=dd26836.kasserver.com
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/24 09:45:53
X-ACL-Warn: Detected OS   = Linux 3.11 and newer [fuzzy]
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: Danny Milosavljevic <dannym@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

* gnu/packages/commencement.scm (glibc-final): Catch all cases of a glibc user not
requesting 64-bit offsets and then using readdir.
---
 gnu/packages/commencement.scm | 52 ++++++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index e5a4caa95c..5a62c9df3a 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3462,7 +3462,57 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                ,hurd-headers-boot0)
              '())
        ,@(package-outputs glibc-final-with-bootstrap-bash))
-      ,@(package-arguments glibc-final-with-bootstrap-bash)))))
+      ,@(substitute-keyword-arguments
+         (package-arguments glibc-final-with-bootstrap-bash)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'patch-dirent
+               (lambda* (#:key outputs #:allow-other-keys)
+                 ;; QEMU transparent emulation is in somewhat of a pickle sometimes.
+                 ;; There is no support in the kernel syscalls of specifying what
+                 ;; kind of userspace you are emulating.  Some parts of the
+                 ;; structures passed back-and-forth between kernel and guest
+                 ;; userspace can change size (including size of individual fields).
+                 ;;
+                 ;; One of the affected structures is "struct dirent".  The ext4
+                 ;; file system puts a 64 bit hash into "d_off" on the kernel side.
+                 ;; If the guest system's glibc is 32 bit it is going to be very
+                 ;; confused (it does check whether d_off fits into the structure
+                 ;; it gives back to the user--and it doesn't fit.  Hence readdir
+                 ;; fails).
+                 ;; This manifests itself in simple directory reads not working
+                 ;; anymore in parts of cmake, for example.
+                 ;;
+                 ;; There is a very simple and complete way to avoid this problem:
+                 ;; Just always use 64 bit offsets in user space programs (also
+                 ;; on 32 bit machines).
+                 ;;
+                 ;; Note: We might want to avoid using 64 bit when bootstrapping
+                 ;; using mescc (since mescc doesn't directly support 64 bit
+                 ;; values)--but then bootstrapping has to be done on a
+                 ;; file system other than ext4, or on ext4 with the feature
+                 ;; "dir_index" disabled.
+                 ;;
+                 ;; The change below does not affect 64 bit users.
+                 ;;
+                 ;; See <https://issues.guix.gnu.org/43513>.
+                 (let ((port (open-file "include/dirent.h" "a")))
+                   (display "
+#if __SIZEOF_LONG__ < 8
+#ifndef __USE_FILE_OFFSET64
+#undef readdir
+#define readdir @READDIR_WITHOUT_FILE_OFFSET64_IS_A_REALLY_BAD_IDEA@
+#endif
+#endif
+" port)
+                   (close-port port))
+                 ;; This file includes <dirent.h> and thus checks sanity already.
+                 ;; TODO: Check dirent/scandir-tail.c, dirent/scandir64-tail.c.
+                 (substitute* "posix/glob.c"
+                  (("(#[ ]*define[ ][ ]*readdir)") "
+#undef readdir
+#define readdir"))
+                 #t)))))))))
 
 (define/system-dependent gcc-boot0-wrapped
   ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the




Acknowledgement sent to Danny Milosavljevic <dannym@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#43591; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 6 Oct 2020 15:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.