From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29961 invoked from network); 24 Feb 2023 16:40:27 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 24 Feb 2023 16:40:27 -0000 Received: (qmail 6111 invoked by uid 550); 24 Feb 2023 16:40:25 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 6079 invoked from network); 24 Feb 2023 16:40:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version; bh=QNRLb1tzGvmO5/b4jTTpRBNL3Ris8NIFNFuJNdAMNDk=; b=BgI7GivwZquwQlceOfd0qzBlgN9oukRNu4LYUFLoUg8z3bhADwa4Ftv5 Fn/aAjyhgmtBAa6XR6Zer+5tj36ANk+LFl5jwODFE8QZc4nQq/3EKtPoy e36aIVRnBDy+j9vaRfZPrkMIjPIVTuVXHurUqZsCA24NbMfLZqeyVzUnx E=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=jens.gustedt@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.97,325,1669071600"; d="scan'208";a="94267785" Date: Fri, 24 Feb 2023 17:40:10 +0100 From: =?UTF-8?B?SuKCkeKCmeKCmw==?= Gustedt To: Tamir Duberstein Cc: musl@lists.openwall.com, NRK , Rich Felker Message-ID: <20230224174010.7b8e2401@inria.fr> In-Reply-To: References: <20230224133413.GE4163@brightrain.aerifal.cx> <20230224135511.iunglqtcvpjeqgtv@gen2.localdomain> <20230224140739.GF4163@brightrain.aerifal.cx> <20230224141731.dm4w7fbfkczbx42e@gen2.localdomain> <20230224151334.ycgddzdc4o5a4m5q@gen2.localdomain> Organization: inria.fr X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) X-Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAACRQTFRFERslNjAsLTE9Ok9wUk9TaUs8iWhSrYZkj42Rz6aD3sGZ MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/MvQ5AaGTWfUxG3EWHnSijT5"; protocol="application/pgp-signature"; micalg=pgp-sha1 Subject: Re: [musl] undefined behavior in fread.c --Sig_/MvQ5AaGTWfUxG3EWHnSijT5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable on Fri, 24 Feb 2023 11:12:11 -0500 you (Tamir Duberstein ) wrote: > I agree, the caller's behavior is UB. I'll send them (freetype2) a > patch. >=20 > That said, do we want to avoid internal UB here anyway? I am not sure that I even understand what "internal UB" is supposed to mean. > - As mentioned earlier, glibc avoids the UB (and the lock). > - llvm-libc does the same starting with > https://github.com/llvm/llvm-project/commit/53c251b > - uclibc avoids the UB but still locks: > https://github.com/gittup/uClibc/blob/9dbf00b/libc/stdio/fread.c#L25 > - FreeBSD avoids the UB but still locks: > https://svnweb.freebsd.org/base/head/lib/libc/stdio/fread.c?view=3Dmarkup= #l76 > - Android (bionic) avoids the UB but still locks: > https://cs.android.com/android/platform/superproject/+/master:bionic/libc= /stdio/stdio.cpp;l=3D1099;drc=3D4aa8f499f21ebf84101de34d68682d5388667001 >=20 > Does this persuade? Me personally not much. The only thing that would help applications to write portable code is to put an attribute on the pointer argument such that bad calls get diagnosed if possible. J=E2=82=91=E2=82=99=E2=82=9B --=20 :: ICube :::::::::::::::::::::::::::::: deputy director :: :: Universit=C3=A9 de Strasbourg :::::::::::::::::::::: ICPS :: :: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus :: :: :::::::::::::::::::::::::::::::::::: =E2=98=8E +33 368854536 :: :: https://icube-icps.unistra.fr/index.php/Jens_Gustedt :: --Sig_/MvQ5AaGTWfUxG3EWHnSijT5 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSN9stI2OFN1pLljN0P0+hp2tU34gUCY/joawAKCRAP0+hp2tU3 4rK/AJ9+tO5kqVML1ZbWylmJFFsU3jtEaACcDArOlyjbKmFomXPbS8WHCNEzVFo= =hCzf -----END PGP SIGNATURE----- --Sig_/MvQ5AaGTWfUxG3EWHnSijT5--