From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id AE1B83858C54 for ; Sat, 18 Mar 2023 07:54:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE1B83858C54 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-oi1-x236.google.com with SMTP id y184so5427996oiy.8 for ; Sat, 18 Mar 2023 00:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679126073; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ESSgT8w5sgTnsHyFI1Z37ra0Yui3QZZOyN9DRW5nrCM=; b=jEZUPaoArU7tfGVrsOp2/ecKIXe6TbMUfyYZZU9dAoxne3KqgxlnvRmsmGdtGsI6MW dmBwb/TWOLwCbrd4DcdJyvJbsanSC1GNZ5O+Oe13ZJ9xB+rmYN232Acsjv9W+bdfCDxG gIOTqv2mvwxQWgACSRvUYB+J1/DgHTXdo6sC6fS+AqLUjYNJUGel+gaAUlJUCaYTWNsm pQVpHzK1ItrdnSkGjZfTfTzemgcV/pNZ2sbfYSq4zo1rTO5fWZnZRUzBl4OTUa36fBfL VTejda/5sufEF8J2d75hMpWM1NjjizRitQ2cAJnyvYZMyE4iYT/bxD2QXkl7CgPnRYci 9YqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679126073; h=content-transfer-encoding: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=ESSgT8w5sgTnsHyFI1Z37ra0Yui3QZZOyN9DRW5nrCM=; b=r3Zcz8Z1T2qqzAxO7eL5hLUCKSUhSLrAqNcIUH/17L9E+M+S30VALHV/saw81MoWjE a6Twic/KqLJJYG3DyCjKQXJ/DCnEgLnrlD1BgIePDlsLqai6/WQGW05Q/VC3pd2p+Wny RzV0IC+QvQy+e0bqq6ythZw6KBbqftJe0Zm83lJ5UhNt3p5wUWgLuh0jg5HQYNJgGU+8 Iwmwho3VcaZFQRKUDzxAb6Qxcmbe5SjHSfLBRUvBTdUCFjTqvkV6MgT34vxndl3mraBI U6VZRSq2qQoYSJIS10JukMKO7b7XjSjW0kSCOEHXSPEIk4mCorJG4QO6RWUb8E6NgV0C 2DqA== X-Gm-Message-State: AO0yUKVDB4nZd6crHIuCTW19KnshAJyfElOpugkQac+1jn/qxfKOPLkl zHjg61uv1FoAMTsna2Qw4gp5igqhYKZ7xMFuCwo= X-Google-Smtp-Source: AK7set/C3uZ5W4iCgzn9WwzSZRR9+OpZ5/oQGPmLsqj/mbulctQwon0jjmLyOVa8JRgMV9FGzjEalvQbZo3N36qD974= X-Received: by 2002:a05:6808:342:b0:386:91d1:34b1 with SMTP id j2-20020a056808034200b0038691d134b1mr3959826oie.10.1679126071577; Sat, 18 Mar 2023 00:54:31 -0700 (PDT) MIME-Version: 1.0 References: <20230205152835.17413-1-alx@kernel.org> <20230206184530.zn5kq7x6xmcfxhqm@redhat.com> In-Reply-To: <20230206184530.zn5kq7x6xmcfxhqm@redhat.com> From: roucaries bastien Date: Sat, 18 Mar 2023 07:54:05 +0000 Message-ID: Subject: Re: [PATCH] sockaddr.3type: BUGS: Document that libc should be fixed using a union To: Eric Blake Cc: Alejandro Colomar , linux-man@vger.kernel.org, Alejandro Colomar , GCC , glibc , =?UTF-8?Q?Bastien_Roucari=C3=A8s?= , Stefan Puiu , Igor Sysoev , Rich Felker , Andrew Clayton , Richard Biener , Zack Weinberg , Florian Weimer , Joseph Myers , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: Hi, I have opened a defect at austin group https://www.austingroupbugs.net/view.php?id=3D1641 Bastien Le lun. 6 f=C3=A9vr. 2023 =C3=A0 18:45, Eric Blake a = =C3=A9crit : > > On Sun, Feb 05, 2023 at 04:28:36PM +0100, Alejandro Colomar wrote: > > Regardless of the merits of the patch, let's not introduce typos: > > > +++ b/man3type/sockaddr.3type > > @@ -120,6 +120,26 @@ .SH NOTES > > .I > > and > > .IR . > > +.SH BUGS > > +.I sockaddr_storage > > +was designed back when strict aliasing wasn't a problem. > > +Back then, > > +one would define a variable of that type, > > +and then access it as any of the other > > +.IR sockaddr_ * > > +types, > > +depending on the value of the first member. > > +This is Undefined Behavior. > > +However, there is no way to use these APIs without invoking Unedfined = Behavior, > > Undefined > > > +either in the user program or in libc, > > +so it is still recommended to use this method. > > +The only correct way to use different types in an API is through a uni= on. > > +However, > > +that union must be implemented in the library, > > +since the type must be shared between the library and user code, > > +so libc should be fixed by implementing > > +.I sockaddr_storage > > +as a union. > > .SH SEE ALSO > > .BR accept (2), > > .BR bind (2), > > Also, while I could raise the issue with the Austin Group on your > behalf to get the POSIX wording improved, I think it would work better > if you initiate a bug report rather than having me do it: > > https://www.austingroupbugs.net/main_page.php > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. +1-919-301-3266 > Virtualization: qemu.org | libvirt.org >