From: Alejandro Colomar <alx.manpages@gmail.com>
To: Eric Blake <eblake@redhat.com>
Cc: linux-man@vger.kernel.org, "Alejandro Colomar" <alx@kernel.org>,
"Bastien Roucariès" <rouca@debian.org>,
glibc <libc-alpha@sourceware.org>, GCC <gcc@gcc.gnu.org>,
"Stefan Puiu" <stefan.puiu@gmail.com>,
"Igor Sysoev" <igor@sysoev.ru>, "Rich Felker" <dalias@libc.org>,
"Andrew Clayton" <andrew@digital-domain.net>,
"Richard Biener" <richard.guenther@gmail.com>,
"Zack Weinberg" <zack@owlfolio.org>,
"Florian Weimer" <fweimer@redhat.com>,
"Joseph Myers" <joseph@codesourcery.com>,
"Jakub Jelinek" <jakub@redhat.com>, "Sam James" <sam@gentoo.org>
Subject: Re: [PATCH] sockaddr.3type: Document that sockaddr_storage is the API to be used
Date: Thu, 6 Apr 2023 18:31:24 +0200 [thread overview]
Message-ID: <7396024c-62d4-a19c-b7bc-e24a9d4bcb31@gmail.com> (raw)
In-Reply-To: <qeo4eortjhpardcwgpjf6ryp56ivpzauzceszufkgdc2yrdrp7@ucmx7voexotw>
[-- Attachment #1.1: Type: text/plain, Size: 3021 bytes --]
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 without
>> enough eyes checking it. So this will be a long email.
>
> Because your mail landed in a publicly archived mailing list, the
> POSIX folks saw it anyways ;)
:)
>
> ...
>>>
>>> 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 reserved
>>> 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.
>
> 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.
>
> ...
>>
>> 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 socket
>> address structures can alias each other for accessing their first member,
>
> 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=unix&sektion=4 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.
>
> 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):
>
> https://austingroupbugs.net/view.php?id=1641#c6255
Thanks! That wording (both paragraphs) LGTM.
Cheers,
Alex
--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-04-06 16:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 17:13 Alejandro Colomar
2023-03-30 19:11 ` Eric Blake
2023-04-05 0:42 ` Alejandro Colomar
2023-04-06 16:24 ` Eric Blake
2023-04-06 16:31 ` Alejandro Colomar [this message]
[not found] ` <6fdadcff-95a2-44fe-9453-d0200822e01e@app.fastmail.com>
[not found] ` <cgetryf5sc3cn6p4ssb47pa2nivjw5vughv6pmpc6qykt3y3bd@teqf7o5uapqm>
[not found] ` <bba87d12-77ce-386c-ba85-e20a7a1e4b22@owlfolio.org>
2023-04-21 14:58 ` Alejandro Colomar
2023-04-21 15:00 ` Alejandro Colomar
2023-04-21 15:27 ` Eric Blake
2023-04-21 20:27 ` [PATCH v3] sockaddr.3type: POSIX Issue 8 will solve strict-aliasing issues with these types Alejandro Colomar
2023-04-21 20:35 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7396024c-62d4-a19c-b7bc-e24a9d4bcb31@gmail.com \
--to=alx.manpages@gmail.com \
--cc=alx@kernel.org \
--cc=andrew@digital-domain.net \
--cc=dalias@libc.org \
--cc=eblake@redhat.com \
--cc=fweimer@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=igor@sysoev.ru \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=richard.guenther@gmail.com \
--cc=rouca@debian.org \
--cc=sam@gentoo.org \
--cc=stefan.puiu@gmail.com \
--cc=zack@owlfolio.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).