From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, PDS_RDNS_DYNAMIC_FP,RCVD_IN_DNSWL_HI,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS,T_PDS_OTHER_BAD_TLD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B54FB1F601 for ; Sat, 3 Dec 2022 15:55:41 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="BVEy88VK"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38D71385843A for ; Sat, 3 Dec 2022 15:55:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38D71385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670082938; bh=Gqxfhdpj2UmqLR3wMujtLu2dhLCFX3eL8nIeypcA0EA=; h=Subject:To:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=BVEy88VK6SHgPfbg6C47g/6/b1bf1fdfJzjWWa8L0n4royNnCZBO63RouY5ErYcjv Skybq/EkmZW4q+pDjgwZyMe6PsKBRILVvIr4KII+X2pRiOFjynX1hn5NOECEs8rH/2 lZqSC1jY8H6OoPvoGagZG0NYfWeWb/BiBVujnOGQ= Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 5A8833858D39 for ; Sat, 3 Dec 2022 15:55:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A8833858D39 Received: from [IPv6:240e:358:1159:3000:dc73:854d:832e:3] (unknown [IPv6:240e:358:1159:3000:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 17BED65B0A; Sat, 3 Dec 2022 10:55:13 -0500 (EST) Message-ID: <8292ef824696e0fbac4f4ed036aad43c0458b8a2.camel@xry111.site> Subject: Re: bind(2): Missing [[gnu::nonnull]] To: Alejandro Colomar , GNU C Library Date: Sat, 03 Dec 2022 23:55:06 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Xi Ruoyao via Libc-alpha Reply-To: Xi Ruoyao Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Sat, 2022-12-03 at 16:33 +0100, Alejandro Colomar via Libc-alpha wrote: > Hi! >=20 > I'm documenting NULLness of parameters in the Linux man-pages.=C2=A0 Whil= e doing=20 > that, I noticed bind(2) is not prototyped with nonnull, but I don't think= it=20 > makes sense to accept NULL.=C2=A0 Is it a mistake?=C2=A0 Should I send a = patch for adding it? Hi Alejandro, Currently the man page says: EFAULT: addr points outside the user's accessible address space. And bind(2) indeed sets errno to EFAULT and return -1 when NULL is passed as addr. gnu::nonnull is not only a diagnostic attribute: it also allows the compiler to assume addr is never NULL. i. e. if addr was gnu::nonnull and bind(2) is called with addr =3D=3D NULL, the behavior would be undefined. So this will be an API change. Yes I agree calling bind with NULL does not make any sense, but I guess we still need to keep API "compatibility" with those nonsense code... --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University