From owner-svn-src-head@freebsd.org Sat Apr 15 11:00:29 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 790C0D3DD6E for ; Sat, 15 Apr 2017 11:00:29 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3EE8587F for ; Sat, 15 Apr 2017 11:00:29 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-it0-x235.google.com with SMTP id 70so5945055ita.0 for ; Sat, 15 Apr 2017 04:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=60fVQhkct5u0itCHcRSu+pTGq9Bkbgi0zZWye7m03ak=; b=HFrbFjRW4kBnlaPZBzzFk5EUh/Xx8V+2CKJxlqwc3dbHANAnt0/7+0Nep1/oqjwlBM EtVZ5ytvzyMxfAsy9m65T+QQioUD0LYHWqZE10O7AH3XFsXGcV1pQJn1jkjF6C5moMK6 hg/7bPDCv5kXzVfRPOU+MeBVYmbQ3xfwMb2Wt+SGEGzIRyF7NUWa9FTObHW2GOlizUCV TWZzScJ/c6SbDUrdvo4x2sZGdCKJfoiCK3y+1zeX3Ddp/UW5BZihmQcDHYbT9AeaDXPB vv98xm28AtU2LrVcdPqBrGcrgyDQHPMZnANLicwHYtmojIjazNb3G46jy3Y+9Y29osJz Xyig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=60fVQhkct5u0itCHcRSu+pTGq9Bkbgi0zZWye7m03ak=; b=pQvx2EFw3rjQ4CmKEJ1YSzzWn8tjw7l75Hdb+X8eWWo+S9Yz11ZVvlXhVtkoDAlq35 AIcTwYNMNHJ2NbHza3EY6KV0tHWzJklXwDvgk5zcAcqmeQO6MuZjkQz2ysYlbPUCpBW7 goAiWqp32wm6YjCNh+THT/iKexA6jKtqGC3NumsnBtnqKtPVnoW2ABOkazZ/KUo9wPqe yy+CdgIg3IVL6KwmoZC5ggtDbEoAgpohoZY3x3S1xtu+4ci3Kdl3h61b5iliRX3ldvvF TOdSBeod56qT6bMe2G6MtG6NWoaB59+w7OqZLa7NpDju/bgI5erWG+1gGOLDitt2HHQC RGCg== X-Gm-Message-State: AN3rC/7iOJgcPhhPD/64Vdsb6n69zi8QgGcKs3Wwfi37/acNvLCLqSJf moM6iHTf8tjk76iNdkCDcE/NV/Z5Mx+h X-Received: by 10.36.213.3 with SMTP id a3mr1577012itg.106.1492254027517; Sat, 15 Apr 2017 04:00:27 -0700 (PDT) MIME-Version: 1.0 Sender: sobomax@sippysoft.com Received: by 10.36.104.135 with HTTP; Sat, 15 Apr 2017 04:00:27 -0700 (PDT) In-Reply-To: <11221477.gRA6BXfcIE@overcee.wemm.org> References: <201704141723.v3EHNS3B043902@repo.freebsd.org> <2109294.KVn8xeR1jZ@overcee.wemm.org> <11221477.gRA6BXfcIE@overcee.wemm.org> From: Maxim Sobolev Date: Sat, 15 Apr 2017 04:00:27 -0700 X-Google-Sender-Auth: BJWAbN0NakrI4QHXYjpmFGGOfr4 Message-ID: Subject: Re: svn commit: r316874 - head/sys/kern To: Peter Wemm Cc: "Ngie Cooper (yaneurabeya)" , svn-src-all@freebsd.org, src-committers , Hiroki Sato , Hiren Panchasara , svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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 11:00:29 -0000 Peter, Ngie, none of this stuff is really directly related to the shutdown(2) change, so I'll probably let Hiroki to clean it up. -Max On Fri, Apr 14, 2017 at 11:58 PM, Peter Wemm wrote: > On Friday, April 14, 2017 08:13:52 PM Ngie Cooper wrote: > > > On Apr 14, 2017, at 20:12, Peter Wemm wrote: > > > > > > 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: > > >>>> > > >>>> Peter, Ngie, > > >>>> > > >>>> Looks like out of that refactoring came a logical bug that is > present > > >>>> in > > >>>> the head, which causes syslod to first to shutdown the socket for > > >>>> reading > > >>>> and then try to select/recv on it (which is somewhat stupid). And > that > > >>>> issue has been masked by shutdown() on datagram socket becoming > > >>>> effectively a NOP in 11 & head 20 months ago. It only affects head > > >>>> though, 11-stable still has the old code which does not include that > > >>>> half-closed socket into the select list. Attached patch is expected > to > > >>>> fix head, Peter, it would be nice if you can give it a try > (restoring > > >>>> latest changes into uipc_sockets.c) and let me know if it helps. > > >>>> > > >>>> Thanks! > > >>> > > >>> CCing hrs@ for input as he did the refactoring. > > >>> Thanks! > > >>> -Ngie > > >>> > > >>> PS LGTM with the change. Will wait for feedback from wemm@. > > >> > > >> This is definitely not working. I get ENOSPC and listen queue > overflows > > >> on /var/run/logpriv now. > > >> > > >> Grabbing an old 10.3 /usr/sbin/syslogd and placing it on the top of > the > > >> 12.x one worked fine, aside from the include statements. > > > > > > This can't be right: > > > if (SecureMode || res->ai_family == AF_LOCAL) { > > > > > > /* Forbid communication in secure mode. */ > > > if (shutdown(s, SHUT_RD) < 0 && > > > > > > errno != ENOTCONN) { > > > > > > logerror("shutdown"); > > > if (!Debug) > > > > > > die(0); > > > > > > } > > > dprintf("listening on socket\n"); > > > sl_recv = NULL; > > > > > > } > > > > > > This appears to disable unix domain sockets like /var/run/log and > > > /var/run/logpriv. > > > > ACK. This looks like a fun bug. > > > -Ngie > > I suspect it's meant to be "if (SecureMode && res->ai_family != AF_LOCAL) > {" > as a simple logic inversion error of another line earlier. However > there's an > 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 going > to > happen. > 3) dprintf("listening on socket") in code that only happens when we're NOT > going to listen. > 4) dprintf("sending on socket") in the code path when we're going to > listen. > 5) shutdown on all unix domain sockets, regardless of securemode.. > > This code block makes my head spin. > > -- > Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; > KI6FJV > UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 >