From owner-svn-src-head@freebsd.org Sat Apr 15 06:59:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE63FD3FB08; Sat, 15 Apr 2017 06:59:00 +0000 (UTC) (envelope-from peter@wemm.org) Received: from smtp2.wemm.org (smtp2.wemm.org [192.203.228.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C84C4A0; Sat, 15 Apr 2017 06:59:00 +0000 (UTC) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 94EE75B4; Fri, 14 Apr 2017 23:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1492239539; bh=JQXK13kc4JvQcILPSn/aG6FqsfP/HE0UDbkepQ/3yoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=erV80m+ZrW+lNNT0+HhO+AxWnU+Kf8F5JFNQRDOll4gdMO3kqeO99/BNThEBuDLOO rXMf2rOrQO/qCnvq39lQ1L4/e6v7FDZbQ+yi8hix7CJHizKkQ1O8G/dcsDz81oAxYI UDfqSnVa8hF4HdBDVntiuHWWPuOAsTI+TfEiTtNg= From: Peter Wemm To: "Ngie Cooper (yaneurabeya)" Cc: svn-src-all@freebsd.org, src-committers , Hiroki Sato , Hiren Panchasara , svn-src-head@freebsd.org, Maxim Sobolev Subject: Re: svn commit: r316874 - head/sys/kern Date: Fri, 14 Apr 2017 23:58:55 -0700 Message-ID: <11221477.gRA6BXfcIE@overcee.wemm.org> User-Agent: KMail/4.14.10 (FreeBSD/12.0-CURRENT; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201704141723.v3EHNS3B043902@repo.freebsd.org> <2109294.KVn8xeR1jZ@overcee.wemm.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart10292938.hy7NMZA4S1"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Apr 2017 06:59:01 -0000 --nextPart10292938.hy7NMZA4S1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Friday, April 14, 2017 08:13:52 PM Ngie Cooper wrote: > > On Apr 14, 2017, at 20:12, Peter Wemm wrote: > >=20 > > On Friday, April 14, 2017 07:36:55 PM Peter Wemm wrote: > >> On Friday, April 14, 2017 02:14:16 PM Ngie Cooper wrote: > >>>> On Apr 14, 2017, at 14:10, Maxim Sobolev = wrote: > >>>>=20 > >>>> Peter, Ngie, > >>>>=20 > >>>> Looks like out of that refactoring came a logical bug that is pr= esent > >>>> in > >>>> the head, which causes syslod to first to shutdown the socket fo= r > >>>> reading > >>>> and then try to select/recv on it (which is somewhat stupid). An= d that > >>>> issue has been masked by shutdown() on datagram socket becoming > >>>> effectively a NOP in 11 & head 20 months ago. It only affects he= ad > >>>> though, 11-stable still has the old code which does not include = that > >>>> half-closed socket into the select list. Attached patch is expec= ted to > >>>> fix head, Peter, it would be nice if you can give it a try (rest= oring > >>>> latest changes into uipc_sockets.c) and let me know if it helps.= > >>>>=20 > >>>> Thanks! > >>>=20 > >>> CCing hrs@ for input as he did the refactoring. > >>> Thanks! > >>> -Ngie > >>>=20 > >>> PS LGTM with the change. Will wait for feedback from wemm@. > >>=20 > >> This is definitely not working. I get ENOSPC and listen queue ov= erflows > >> on /var/run/logpriv now. > >>=20 > >> Grabbing an old 10.3 /usr/sbin/syslogd and placing it on the top o= f the > >> 12.x one worked fine, aside from the include statements. > >=20 > > This can't be right: > > if (SecureMode || res->ai_family =3D=3D AF_LOCAL) {= > > =20 > > /* Forbid communication in secure mode. */ > > if (shutdown(s, SHUT_RD) < 0 && > > =20 > > errno !=3D ENOTCONN) { > > =20 > > logerror("shutdown"); > > if (!Debug) > > =20 > > die(0); > > =20 > > } > > dprintf("listening on socket\n"); > > sl_recv =3D NULL; > > =20 > > } > >=20 > > This appears to disable unix domain sockets like /var/run/log and > > /var/run/logpriv. >=20 > ACK. This looks like a fun bug. > -Ngie I suspect it's meant to be "if (SecureMode && res->ai_family !=3D AF_LO= CAL) {"=20 as a simple logic inversion error of another line earlier. However the= re's an=20 awful lot of strange things in this code. 1) listen(s, 5) - on datagram sockets. 2) dprintf("shutdown") in code regardless of whether the shutdown is go= ing to=20 happen. 3) dprintf("listening on socket") in code that only happens when we're = NOT=20 going to listen. 4) dprintf("sending on socket") in the code path when we're going to li= sten. 5) shutdown on all unix domain sockets, regardless of securemode.. This code block makes my head spin. =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart10292938.hy7NMZA4S1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEBgrA0Vr/vfNVuPoUNdaXCeyAngQFAljxxK8ACgkQNdaXCeyA ngTWzAgAwTxqh8URPRWoP4xssbIcrHxQp24Vo3b2ybHpVmG+4VNudT2X2gb5tRso CpCy4rMNZd8OY+rIcC8lzIexFgmvnwGEfZQgBjXiDK1cup5ylg6aR/CPziJ38jk/ uR56sh3hPiIONPHht5TlRrXpZAMN3NrX08GqTP1gXC5uoB0nCViffBkew+54bK+h OduYGUkqkiIV2aHzVKDX/sv8dnqS0SOJKZIf4YRyDp5qyg3Wu2yAj7427+vI2pPc d1R4A5BHajEPLcxssFRWD/SQug0hUG7cZwyX7d8qoD3LqZEFecF/Oe3sdJAFFiQZ ZGxmddHKfLwJhhtvOwIbYn+4IFvc9g== =XJBZ -----END PGP SIGNATURE----- --nextPart10292938.hy7NMZA4S1--