From owner-svn-src-head@freebsd.org Mon Jul 23 23:52:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 622DC105756C; Mon, 23 Jul 2018 23:52:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9FDDD736E2; Mon, 23 Jul 2018 23:52:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id hkdIfdlAs5HxqhkdJf6hAR; Mon, 23 Jul 2018 17:52:55 -0600 X-Authority-Analysis: v=2.3 cv=BMcHU2YG c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=R9QF1RCXAYgA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=8lvgirPTP3_Ux8JaNysA:9 a=z2oZpG1v89SIaMLB:21 a=kU4lhY3wRZSrKRwn:21 a=wPNLvfGTeEIA:10 a=xN_wL00nb8BHSiEss3MA:9 a=Ysl1PTvUpGQXxRmH:21 a=u3TfuPd13cBKW6c_:21 a=fUCoWJuRHluB_zAX:21 a=_W_S_7VecoQA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from [25.80.33.197] (S0106788a207e2972.gv.shawcable.net [70.66.154.233]) by spqr.komquats.com (Postfix) with ESMTPSA id 2DB5EC73; Mon, 23 Jul 2018 16:52:58 -0700 (PDT) MIME-Version: 1.0 From: Cy Schubert Subject: RE: svn commit: r336619 - head/lib/libc/gen Date: Mon, 23 Jul 2018 16:52:51 -0700 To: Ian Lepore CC: Alan Somers , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-Id: <20180723235258.2DB5EC73@spqr.komquats.com> X-CMAE-Envelope: MS4wfCXSw7zUQsyHgwl8RmgcVQvFmvOaCUvT8k2GetElp9gJCiCptgp3XJJyOKjNPCZHUGWXQQZXkISBTkUc7jjEdJBeBuVQG1Qv7TdODW7QKOV8j4ibLBHN zROfpuplHiJH+vgt8q5yUrAKPSP2+BqnHzYGViB6U/f49q31zz9WFAWoKeNEOTRxsgjRRUZrIh7wuQEHgHFwdTcq+ljO+ylKz9I6XG5SuNiVXQVYwrDiw6dx VOtJJutuYlXdWUQwUyy+/qv7X+fUy7d0goPLmSOYU1TzJ6+EWxB8ge2aFq34VUgTuprOh6rvwMBt/WaMl+0b7tj1yN2wYi5TjqemPeJRqlQ= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 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: Mon, 23 Jul 2018 23:52:58 -0000 I think you misunderstood me because of my terse email. Sorry about that. W= e can address this with a NULL check in openssh's misc.c. I can't recall th= e actual path. I'll post a patch, which will explain it better than I can i= n English, as soon as I get home. --- Sent using a tiny phone keyboard. Apologies for any typos and autocorrect. Also, this old phone only supports top post. Apologies. Cy Schubert or The need of the many outweighs the greed of the few. --- -----Original Message----- From: Ian Lepore Sent: 23/07/2018 13:40 To: Cy Schubert Cc: Alan Somers; src-committers; svn-src-all@freebsd.org; svn-src-head@free= bsd.org Subject: Re: svn commit: r336619 - head/lib/libc/gen On Mon, 2018-07-23 at 13:11 -0700, Cy Schubert wrote: > In message <1532364679.1344.161.camel@freebsd.org>, Ian Lepore > writes: > >=20 > > On Mon, 2018-07-23 at 09:41 -0700, Cy Schubert wrote: > > >=20 > > > I'm sure. Rolling this libc commit back addressed the ssh > > > segfaults > > > on all my systems. > > >=20 > > > --- > > > Sent using a tiny phone keyboard. > > > Apologies for any typos and autocorrect. > > > Also, this old phone only supports top post. Apologies. > > >=20 > > > Cy Schubert > > > or > > > The need of the many outweighs the greed of the few. > > > --- > > >=20 > > My current working theory is that some of the software that uses > > __pw_scan() pre-stages a pointer-to-empty-string into the pw_class > > field and my change ruined that by replacing it with a NULL > > pointer. > > Other callers of __pw_scan() don't do that, they just assume > > they're > > running as root and will get all the fields populated. > Yes. A simple check for pw->pw_class !=3D NULL should fix this > instance. >=20 >=20 No, that doesn't work, because __pw_scan just skips setting pw_class and that leaves non-NULL garbage in that pointer. =A0There is a pw_fields field that uses bits to indicate which fields were parsed, but almost nothing uses it, so I'm reluctant to rely on it because this same kind of unexpected crash of some random tool will happen if there's anything that fills out a pwd struct without making those flags valid then calls pw_copy() which would rely on them being valid. I've decided that the only safe way to fix this is to have pw_scan() do the same thing getpwnam() and friends do: =A0first init the pwd struct to known values, including supplying empty strings rather than NULL pointers for all the char* fields, before calling __pw_scan(). But, all of a sudden I've gotten busy with $work, so I may have to set all this aside for a few days. -- Ian