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 3642 invoked from network); 24 Feb 2023 17:32:32 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 24 Feb 2023 17:32:32 -0000 Received: (qmail 9717 invoked by uid 550); 24 Feb 2023 17:32:29 -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 9684 invoked from network); 24 Feb 2023 17:32:29 -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=9qySANF5mB0R33rULoFyCN1oRQbWxChYfqprBIjutR0=; b=agI/19g2PbkGX/txrH06+WoLFNkxZGcWxdcP5lOyoODasYj5FcLZd4q22AaL6ThvCL FDYIDuqo8REFAFuln4S3c9rMSV7iYutX53AYlY3TlHVPe1mlGjWu9BoBxW4NniPrDwUI e1jjX1Y96d+I+M/JvZT0ofcZy7ICk7+bQkQW+wEih64luwRHVigf9tCuJsn4ccXoDSeb +cmBbReHs0rGKKehvUt2zygO2jAuT4ua5pHQdbHs8qF4hsxPe5G8N5S6lL9sJxV5cJ+d osD+b2pVUOH0MeKzd+rFhtX91CIewbQibT65EpHki8ADBj5Vy3GRl0sdm7+hXPoqlnHX EdpQ== 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=9qySANF5mB0R33rULoFyCN1oRQbWxChYfqprBIjutR0=; b=xQnRRPKROXQH0oipyOv1AEk4Z6sAih9k/uhEww+mAUlc2+aFmFd5gcvtYfZZ4SZzq3 HSAEwydgrXJ2WLJh1ubuoE+EznyBTG7Mi1DK6uDDSi6X9JotEy7/KlsUiuWFInnLJ0WX B7jYfTGETHwTtXZpr32Ueb1TlkigVi2PNJ/bymYHAplM6IK4ZaJ8k6SKHIJDAEH6RL0z B44J2TPo15+cTev+jvx0chvzA53lHuOxpx44K+Cxg92WZIi27jQhs7Dwlmyxtf72bXYZ wc+tMSMBjKiZoRR6m4ucOqRbcol5A1ap3IQGMBp5D2NfKGR+pBwrI/AUW7y7I2ak0W1i uF2Q== X-Gm-Message-State: AO0yUKVv8xRMUxYNSs5DI91hFSN43IID+0Gh7v+6Tua/+3CV6UVyLwUd kR9R9ESU8KXuXoyD2iQ//1b5Ch5SBzWC+Jf9jklo X-Google-Smtp-Source: AK7set/GNa/H/1NwcgSFa4c2gMX4YO12hVMxKUgWRPhH6+4lYQwdnp/7PpTrJsxgBvV8OAhjb3a/pAvftT3sDSmfsek= X-Received: by 2002:a81:ad0f:0:b0:52e:cea7:f6e0 with SMTP id l15-20020a81ad0f000000b0052ecea7f6e0mr4939589ywh.7.1677259936814; Fri, 24 Feb 2023 09:32:16 -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: From: Tamir Duberstein Date: Fri, 24 Feb 2023 12:32:05 -0500 Message-ID: To: enh Cc: musl@lists.openwall.com, NRK , Rich Felker Content-Type: multipart/alternative; boundary="000000000000bb4fdd05f5758260" Subject: Re: [musl] undefined behavior in fread.c --000000000000bb4fdd05f5758260 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Clang's qualifiers fail to parse in GCC, so __attribute__((nonnull (1))) seems like the only somewhat portable solution. Would you folks actually consider using it? On Fri, Feb 24, 2023 at 12:07 PM enh wrote: > > > 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-attribute= s > > >> 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 :: >> > --000000000000bb4fdd05f5758260 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Clang's qualifiers fail to parse in GCC, so=C2=A0__att= ribute__((nonnull (1))) seems like the only somewhat portable solution.
Would you folks actually consider using it?

=
On Fri, Fe= b 24, 2023 at 12:07 PM enh <enh@google= .com> wrote:


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/AttributeReference.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 ::
--000000000000bb4fdd05f5758260--