From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 9021D3858D32 for ; Thu, 6 Apr 2023 16:31:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9021D3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x42e.google.com with SMTP id g5so162776wrb.5 for ; Thu, 06 Apr 2023 09:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680798686; x=1683390686; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=lcCGAbJqw90LO7oNh6OTwmshJbMhTlT+b5RK8YHx6ic=; b=qnLEeOLr1ftAf9WXdDPLjBUb/528wjKx6gCzUngJdpR2YsdqAVBykLrO1zlJyV6xZO INWj7z8hC5V89IXXnhxzIX/C4dZ5kUgkUNtPHE5/bBa9swWNijj6KBro99LSp6FFxVvh N9ZlgD6zmdWVY2B+cqPHAEa7hP0yCMRwGj/0gJGmi+BFBt2kjQi4kdFuzQr22rm+mmvM jmpOufooxKdeyLrh4bXGRYjq9rmRO/0w1zD1mkv7mxu9nHbUUbJOW5sboBTT/r5twAgj oRIYSjTNlZvnkKChzRBVDq5eTcnqVU/R8SVp4/rkmn/nL0FysJUEF5YErsTJGMJPlNDE Nbxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680798686; x=1683390686; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=lcCGAbJqw90LO7oNh6OTwmshJbMhTlT+b5RK8YHx6ic=; b=f67g6/XbmEMCveq27eFqapIPev5KG5H3L1sDKzvCWRWrvkBi0QcTZfpeU9U6Ht3v71 105ySkdfZn8ClYq2AFQi158IvgMPaDkRkjRoFNwUhicSwd7YkyNrTToTbAje15hF8JoE BaZLLdfXawmEf6v3CuUI5IWw5Pk36Uk4sRFm1VwaB5YAc/5yjZY21GoR2tsaBTpMdlAL upPypF+dcOI0NMmlGmqZ9fzaA84P/DBx20DwHU38R35tOGhQ9qxqn2ROCxxNVBDlfa+t PvocfrnvXRt5IiK8d+kJ+pdcNK3anMJiMjp6GssH3M99S4P/PVop+izTIEi7CM6DVUiM YAgg== X-Gm-Message-State: AAQBX9cuWedUTbnJ31j57EyC0C94p4SUhkkrx2ueb1MjAfVeivUbPQnd D0nqApmN+5X7gijxfVTMP+M= X-Google-Smtp-Source: AKy350ZCg9GoT30OiHXRo4v2Ax2DXIqCAdzyZLsWVadNfWjAnc2mJXNFOdyoIELgxaR4vhTxa/bAqg== X-Received: by 2002:adf:f14c:0:b0:2ce:bd2e:1fea with SMTP id y12-20020adff14c000000b002cebd2e1feamr7081331wro.26.1680798686494; Thu, 06 Apr 2023 09:31:26 -0700 (PDT) Received: from [192.168.0.160] ([170.253.51.134]) by smtp.gmail.com with ESMTPSA id f3-20020adff983000000b002ef57ea5d74sm925531wrr.27.2023.04.06.09.31.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Apr 2023 09:31:26 -0700 (PDT) Message-ID: <7396024c-62d4-a19c-b7bc-e24a9d4bcb31@gmail.com> Date: Thu, 6 Apr 2023 18:31:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] sockaddr.3type: Document that sockaddr_storage is the API to be used Content-Language: en-US To: Eric Blake Cc: linux-man@vger.kernel.org, Alejandro Colomar , =?UTF-8?Q?Bastien_Roucari=c3=a8s?= , glibc , GCC , Stefan Puiu , Igor Sysoev , Rich Felker , Andrew Clayton , Richard Biener , Zack Weinberg , Florian Weimer , Joseph Myers , Jakub Jelinek , Sam James References: <20230330171310.12330-1-alx@kernel.org> <9b528ba9-e1c6-1c03-8ec7-177c4dc66e19@gmail.com> From: Alejandro Colomar In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------awn0eppevvrHafHahCFsb59V" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------awn0eppevvrHafHahCFsb59V Content-Type: multipart/mixed; boundary="------------ahshnqOhZmM59WbBltVzJbsN"; protected-headers="v1" From: Alejandro Colomar To: Eric Blake Cc: linux-man@vger.kernel.org, Alejandro Colomar , =?UTF-8?Q?Bastien_Roucari=c3=a8s?= , glibc , GCC , Stefan Puiu , Igor Sysoev , Rich Felker , Andrew Clayton , Richard Biener , Zack Weinberg , Florian Weimer , Joseph Myers , Jakub Jelinek , Sam James Message-ID: <7396024c-62d4-a19c-b7bc-e24a9d4bcb31@gmail.com> Subject: Re: [PATCH] sockaddr.3type: Document that sockaddr_storage is the API to be used References: <20230330171310.12330-1-alx@kernel.org> <9b528ba9-e1c6-1c03-8ec7-177c4dc66e19@gmail.com> In-Reply-To: --------------ahshnqOhZmM59WbBltVzJbsN Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Eric, On 4/6/23 18:24, Eric Blake wrote: > On Wed, Apr 05, 2023 at 02:42:04AM +0200, Alejandro Colomar wrote: >> Hi Eric, >> >> I'm going to reply both your emails here so that GCC is CCed, and they= can >> suggest better stuff. I'm worried about sending something to POSIX wi= thout >> enough eyes checking it. So this will be a long email. >=20 > Because your mail landed in a publicly archived mailing list, the > POSIX folks saw it anyways ;) :) >=20 > ... >>> >>> Whether gcc already has all the attributes you need is not my area of= >>> expertise. In my skim of the glibc list conversation, I saw mention >>> of attribute [[gnu:transparent_union]] rather than [[__may_alias__]] = - >>> if that's a better implementation-defined extension that does what we= >>> need, then use it. The standard developers were a bit uncomfortable >>> directly putting [[gnu:transparent_union]] in the standard, but >>> [[__may_alias__]] was noncontroversial (it's in the namespace reserve= d >>> for the implementation) >> >> Not really; implementation-defined attributes are required to use an >> implementation-defined prefix like 'gnu::'. So [[__may_alias__]] is >> reserved by ISO C, AFAIR. Maybe it would be better to just mention >> attributes without any specific attribute name; being fuzzy about it >> would help avoid making promises that we can't hold. >=20 > On this point, the group agreed, and we intentionally loosened to > wording to just mention an implementation-defined extension, rather > than giving any specific attribute name. >=20 > ... >> >> I would just make it more fuzzy about which standard version did what.= >> How about this?: >> >> [[ >> Note that defining the sockaddr_storage and sockaddr structures using >> only mechanisms defined in editions of the ISO C standard may produce >> aliasing diagnostics. Because of the large body of existing code >> utilizing sockets in a way that could trigger undefined behavior due >> to strict aliasing rules, this standard mandates that the various sock= et >> address structures can alias each other for accessing their first memb= er, >=20 > The sa_family_t member is not necessarily the first member on all > platforms (it happens to be first in Linux, but as a counter-example, > https://man.freebsd.org/cgi/man.cgi?query=3Dunix&sektion=3D4 shows > sun_family as the second one-byte field in struct sockaddr_un). The > emphasis is on derefencing the family member (whatever offset it is > at) to learn what cast to use to then safely access the rest of the > storage. >=20 > As such, here's the updated wording that the Austin Group tried today > (and we plan on starting a 30-day interpretation feedback window if > there are still adjustments to be made to the POSIX wording): >=20 > https://austingroupbugs.net/view.php?id=3D1641#c6255 Thanks! That wording (both paragraphs) LGTM. Cheers, Alex --=20 GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 --------------ahshnqOhZmM59WbBltVzJbsN-- --------------awn0eppevvrHafHahCFsb59V Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmQu89wACgkQnowa+77/ 2zIvow//eXzliYujjolqyV/TarnCOgAQ11EHCt+V7Voif2Qlji9YkD7HxzyxUF52 q2CSIEDG7VViXHZzkQkCwESN3DKh9nUDNBtB54YSzzuPDJQjATbEJ1m/xwJTdZSi uXsY07ghw5IUvtOZsU6jksovntWkwQHQVIuXWA/XDS00oNqY2DYZSOnUlG74sBP5 QjaRIhF5sDdNrv5VsAwweCPdRa+lFbLn6mpvpqZCgWcO1wZen+R06Jc49bpemcXU 61edoeZDojkueE0ugbsy1y0YzAti2diHo77mVZ9F2oA6HJNoaVYo7K+m5LjcSWIp XsnUtaAw0gVMJpLa6Ov8lhaiGCs+omjMv9KEE5k4laiI6A2HPoUSPW+v+RpvsVwL F/M+yrDsmFtnV7RO2Fik3F4ol29r5aJLiVB/mZy1YmTRaswgvwoYnSPEF5AZJbgD fZd3Ar/dvs/xckmBtwy3ylMFYMbUq2HGo/8MQ0DbvTufOAGZm3/aEk62ybwzljVB seOCdaAlkmWe9Ot3CvO4h928OO7wmAFKrXCMK/JcZH3BID3cnUnVd3th+6Fx54QN 4oa44Yoi+/b6BdlLeqhUFFJu5mwNetryRHyDRBqctTdY4GyV0dgyE+6gbL8fhr6P +HoDwTfq3mc6hEFlc0xLDhfETfxmcH+uUPUKaQCVx8sEFZamVGY= =85OZ -----END PGP SIGNATURE----- --------------awn0eppevvrHafHahCFsb59V--