From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Fix use of sockaddr_in Date: Mon, 15 May 2017 09:04:56 +0000 Message-ID: References: <83shk989r5.fsf@gnu.org> <20170513150837.31184-1-phst@google.com> <83h90o8zt9.fsf@gnu.org> <877f1kefhi.fsf@linux-m68k.org> <83a86g8siw.fsf@gnu.org> <87y3u0cyjy.fsf@linux-m68k.org> <838tm088yj.fsf@gnu.org> <8337c78qq6.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1140584cf5a0d1054f8c5900" X-Trace: blaine.gmane.org 1494839183 5098 195.159.176.226 (15 May 2017 09:06:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 15 May 2017 09:06:23 +0000 (UTC) Cc: p.stephani2@gmail.com, emacs-devel@gnu.org To: Paul Eggert , Eli Zaretskii , Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 15 11:06:18 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dABxI-0001AT-FZ for ged-emacs-devel@m.gmane.org; Mon, 15 May 2017 11:06:16 +0200 Original-Received: from localhost ([::1]:35564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dABxO-0001le-1x for ged-emacs-devel@m.gmane.org; Mon, 15 May 2017 05:06:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dABwH-00015i-EG for emacs-devel@gnu.org; Mon, 15 May 2017 05:05:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dABwC-0004t4-67 for emacs-devel@gnu.org; Mon, 15 May 2017 05:05:13 -0400 Original-Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:34901) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dABwC-0004sE-3G for emacs-devel@gnu.org; Mon, 15 May 2017 05:05:08 -0400 Original-Received: by mail-qk0-x231.google.com with SMTP id a72so88217756qkj.2 for ; Mon, 15 May 2017 02:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VhCDHsDAJ9sMDW+Z3ybezicWAzfLmBE5stOwuQ1mnfs=; b=BJvQLZRhQ+XMY4NXcVQbzilO4huoNJE/IKeGLDWM7uxkTOoXtTpDZ+2PkoC7ui9VTl FgV62XjHgo3f8074h8IWbEUf/piQ+dO0d2EYsj2vmMSC8LClfDw2y1DpIhBU24A4amPO IDCCXKTo472FJnfvzAVrctvIXM3YRxSEkWKJZLHyOYujm47+ioAmlXVt60rkUc39o6mZ sz+yMJfwPSlI07rxz2Q56RnX5A6TQhLxle2tYpc2Uf7grJc+rzeoxsgbnKbzu5DvyCZD g3kysfGebwighUv0GFqN8L+kMjTbats1L8Dkb33bfE/Aw5xE7cLjibCWDlbb4ywyPpEL Rg5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VhCDHsDAJ9sMDW+Z3ybezicWAzfLmBE5stOwuQ1mnfs=; b=NgHJXBR2i+tRC+SfZC/EjqqOw5x9MsfOpKJhQEXnYKylyfhTgVy4Ik8qzRUZwxWBST cjd8MwcrJm03vn9/cVUJXzM5LXXRcAinHHbflncKTRySMysU5M2F0LG6lhVeRQfh5t7X zQ7lm0aAag973yhghtYLN4kZLzhW8zOLzGPOu4U9VK1M+IrubkT0TacOiEvHMymmYjJW fC1ntrWh4ZByERmTw8NhH3WBH7rc4gs0uQB048O5h9qanW+v47ETq/3PrtvFcEBPMhaa Yj6RauCq8tUGNVUPuA4YDQzYSfLA5z5ZO5HZHlqqMdl8G+5Pz2r21DNQFlGo9Mh+c7Dk kF/g== X-Gm-Message-State: AODbwcBiX/e6ujmv8y1Jp84/sz6/oZ514kklAUNLSXuVomvLDHNRnp8V BpsEYXvGYHAl9AiwP1GVxsfsW4nt2Q5+ X-Received: by 10.55.33.70 with SMTP id h67mr4635840qkh.163.1494839106810; Mon, 15 May 2017 02:05:06 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214856 Archived-At: --001a1140584cf5a0d1054f8c5900 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Paul Eggert schrieb am Mo., 15. Mai 2017 um 08:15 Uhr: > Eli Zaretskii wrote: > > if your > > intent was to say that this condition should be added to the code, > > i.e. for AF_UNIX we should not try to compute the port, then I agree. > > I installed a modified version of Philipp's patch, to do that. Thanks, > Philipp, > for tracking this down. > > > http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3Dd23a486ba27405acf= da67a4dc387ade5e399a29b Thanks! A few questions to guard against undefined behavior: - Maybe add verify(INT_MAX >=3D TYPE_MAXIMUM(in_port_t)) and verify(TYPE_MINIMUM(in_port_t) =3D=3D 0) to make sure that we can use int f= or the port? - Should there be a guard against the alias violation, e.g. by declaring sa and sa1 with __attribute__((may_alias))? Otherwise it's UB and the compiler might elide the switch entirely. --=20 Google Germany GmbH Erika-Mann-Stra=C3=9Fe 33 80636 M=C3=BCnchen Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Gesch=C3=A4ftsf=C3=BChrer: Matthew Scott Sucherman, Paul Terence Manicle Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind, leiten Sie diese bitte nicht weiter, informieren Sie den Absender und l=C3=B6schen Sie die E-Mail und alle Anh=C3=A4nge. Vielen Dank. This e-mail is confidential. If you are not the right addressee please do not forward it, please inform the sender, and please erase this e-mail including any attachments. Thanks. --001a1140584cf5a0d1054f8c5900 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Paul E= ggert <eggert@cs.ucla.edu> = schrieb am Mo., 15. Mai 2017 um 08:15=C2=A0Uhr:
Eli Zaretskii wrote:
> if your
> intent was to say that this condition should be added to the code,
> i.e. for AF_UNIX we should not try to compute the port, then I agree.<= br>
I installed a modified version of Philipp's patch, to do that. Thanks, = Philipp,
for tracking this down.

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3Dd23a48= 6ba27405acfda67a4dc387ade5e399a29b

Than= ks! A few questions to guard against undefined behavior:
- Maybe = add verify(INT_MAX >=3D TYPE_MAXIMUM(in_port_t)) and verify(TYPE_MINIMUM= (in_port_t) =3D=3D 0) to make sure that we can use int for the port?
<= div>- Should there be a guard against the alias violation, e.g. by declarin= g sa and sa1 with __attribute__((may_alias))? Otherwise it's UB and the= compiler might elide the switch entirely.=C2=A0
--

Google Germany GmbH
Erika-Mann-Stra=C3=9Fe 33
80636 M=C3=BCnchen

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Gesch=C3=A4ftsf=C3=BChrer: Matthew Scott Sucherman, Paul Terence Manicle

Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Ad= ressat sind, leiten Sie diese bitte nicht weiter, informieren Sie den Absen= der und l=C3=B6schen Sie die E-Mail und alle Anh=C3=A4nge. Vielen Dank.

This e-mail is confidential. If you are not the right addres= see please do not forward it, please inform the sender, and please erase th= is e-mail including any attachments. Thanks.

--001a1140584cf5a0d1054f8c5900--