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=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 593 invoked from network); 24 Feb 2023 17:07:26 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 24 Feb 2023 17:07:26 -0000 Received: (qmail 27676 invoked by uid 550); 24 Feb 2023 17:07:23 -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 26619 invoked from network); 24 Feb 2023 17:07:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DzKvg34yXYBuFh06ca2byQz3bSnY+ttTbWgySiSTK7g=; b=eVRCHk8BVYxkxRv05iUHfnRxpIKqDwCBrGpJio54OvKbA1FxVFGJwrz1/2APl+oJ4W ZsUzbfjoI/5FO+BXeuVRiNsZfB36M8dKnBwF/RuWUQHDiCszBY/qFxTrcmnIDTBnv6gF FdHvE0czSHyS8b9ye81K5whTU2ZbZCURebJrKggUmRWd33Oyj0DC5S70msN5cjnuGkLV WkCEBbEDHIZ1RASkovUGsNvkAMIHsP41NWSJh09Nhh1FAsy+/Dpvxj01G9Gf1H4XM08i KWgt0i+UaW4nVvcwC7bfIDnpF0U4snOVS8fAZoB0un2CISP6/UGI6LPL87PTqKgOo0go 4gEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DzKvg34yXYBuFh06ca2byQz3bSnY+ttTbWgySiSTK7g=; b=UlyUmxGQeJkMUrjDAejmxg6vdyBcf8vrFOfMvyLGOf2LAl4O0PRRfLoUnZL2XEEG4X XC/s2SNmGThY8YbUWbnfudHWvsJPEemU6bgY3Xtfc+vMlTx6BYIc54OZNyx1qYMEtQvL pXZB5cdexmegY62ANiViYA7jPxz3UtOjbZzrOcOzbAhqstd2+9ePmCahHpWCzJ1/U784 8KSX2C8IVPG/gyAt5Hikger0hPZqBZM/ewp3oXOczpOVkBZiIROYsXDdDiGRAPrd28Pp CXarQQmc5UFtD5IZ03R1wL9rTct+BGtEddrW1W9xRBZOG1uhdIKbr+hT09XCAb1CZLXn F4VA== X-Gm-Message-State: AO0yUKWgsGKFiYYI1A56uSTTXnsdOtMKoHm2Mo9kAJd1V7g/5C/4oe6a 1LKmY5wz9gVS91pDDViHRyJnMoKfxwAy7w6qWhqe2FN4qUbk70DD9h9mRQ== X-Google-Smtp-Source: AK7set86iFY1ArEJKqg/dY7dbhwWG2Oj91gwOhN3RJO9dflh+Tx4Y6oRsC1mEmFY9koeU1ZDX83wg+zD2RSHgEu7VHc= X-Received: by 2002:a05:6214:a94:b0:56f:2c51:ff89 with SMTP id ev20-20020a0562140a9400b0056f2c51ff89mr2758135qvb.5.1677258431022; Fri, 24 Feb 2023 09:07:11 -0800 (PST) MIME-Version: 1.0 References: <20230224133413.GE4163@brightrain.aerifal.cx> <20230224135511.iunglqtcvpjeqgtv@gen2.localdomain> <20230224140739.GF4163@brightrain.aerifal.cx> <20230224141731.dm4w7fbfkczbx42e@gen2.localdomain> <20230224151334.ycgddzdc4o5a4m5q@gen2.localdomain> <20230224174010.7b8e2401@inria.fr> <20230224180018.7d58ea44@inria.fr> In-Reply-To: <20230224180018.7d58ea44@inria.fr> From: enh Date: Fri, 24 Feb 2023 09:07:00 -0800 Message-ID: To: musl@lists.openwall.com Cc: Tamir Duberstein , NRK , Rich Felker Content-Type: multipart/alternative; boundary="000000000000fab05e05f575280e" Subject: Re: [musl] undefined behavior in fread.c --000000000000fab05e05f575280e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 24, 2023 at 9:00 AM J=E2=82=91=E2=82=99=E2=82=9B Gustedt wrote: > Tamir, > > on Fri, 24 Feb 2023 11:42:30 -0500 you (Tamir Duberstein > ) wrote: > > > Internal UB means "applying zero offset to null pointer" when the > > caller passes (NULL, _, 0, _). > > So you mean internal misbehavior? > > > Does such an attribute exist? > > Yes, gcc has the nonnull old-style attribute, and I think that the C23 > versions of gcc and clang will have something like `[[gnu::nonnull]]`. > > Having this as attribute of the function and not of the pointer is a > bit unfortunate. For non-void pointers you could also use the `[static > 1]` array parameter notation instead of a pointer. > bionic's using clang's _Nullable and _Nonnull, which do let you express this: https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes > J=E2=82=91=E2=82=99=E2=82=9B > > -- > :: ICube :::::::::::::::::::::::::::::: deputy director :: > :: Universit=C3=A9 de Strasbourg :::::::::::::::::::::: ICPS :: > :: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus :: > :: :::::::::::::::::::::::::::::::::::: =E2=98=8E +33 368854536 > <+33%203%2068%2085%2045%2036> :: > :: https://icube-icps.unistra.fr/index.php/Jens_Gustedt :: > --000000000000fab05e05f575280e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Feb 24, 2023 at 9:00 AM J=E2= =82=91=E2=82=99=E2=82=9B Gustedt <jens.gustedt@inria.fr> wrote:
Tamir,

on Fri, 24 Feb 2023 11:42:30 -0500 you (Tamir Duberstein
<tamird@google.co= m>) wrote:

> Internal UB means "applying zero offset to null pointer" whe= n the
> caller passes (NULL, _, 0, _).

So you mean internal misbehavior?

> Does such an attribute exist?

Yes, gcc has the nonnull old-style attribute, and I think that the C23
versions of gcc and clang will have something like `[[gnu::nonnull]]`.

Having this as attribute of the function and not of the pointer is a
bit unfortunate. For non-void pointers you could also use the `[static
1]` array parameter notation instead of a pointer.
bionic's using clang's _Nullable and _Nonnull, which do= let you express this: https://clang.llvm.org/docs/AttributeRef= erence.html#nullability-attributes
=C2=A0
J=E2=82=91=E2=82=99=E2=82=9B

--
:: 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 ::
--000000000000fab05e05f575280e--