From owner-svn-src-head@freebsd.org Sat Jun 1 15:01:48 2019 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 A916F15BF344; Sat, 1 Jun 2019 15:01:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CF96C847; Sat, 1 Jun 2019 15:01:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 0D8A31EC01; Sat, 1 Jun 2019 15:01:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id E9A938D4A142; Sat, 1 Jun 2019 15:01:45 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 0100CE707D4; Sat, 1 Jun 2019 15:01:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id WL1-jqwoMKas; Sat, 1 Jun 2019 15:01:43 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:2ef0:eeff:fe03:ee34]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 5D934E707C2; Sat, 1 Jun 2019 15:01:43 +0000 (UTC) From: "Bjoern A. Zeeb" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r348494 - head/sys/netinet Date: Sat, 01 Jun 2019 15:01:42 +0000 X-Mailer: MailMate (2.0BETAr6137) Message-ID: <8F8F89D8-62A1-4EEA-9457-F511AF67D893@FreeBSD.org> In-Reply-To: <201906011457.x51Evgc9036752@repo.freebsd.org> References: <201906011457.x51Evgc9036752@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: 49CF96C847 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.988,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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, 01 Jun 2019 15:01:48 -0000 On 1 Jun 2019, at 14:57, Bjoern A. Zeeb wrote: > Author: bz > Date: Sat Jun 1 14:57:42 2019 > New Revision: 348494 > URL: https://svnweb.freebsd.org/changeset/base/348494 > > Log: > After parts of the locking fixes in r346595, syzkaller found > another one in udp_output(). This one is a race condition. > We do check on the laddr and lport without holding a lock in > order to determine whether we want a read or a write lock > (this is in the "sendto/sendmsg" cases where addr (sin) is given). > > Instrumenting the kernel showed that after taking the lock, we > had bound to a local port from a parallel thread on the same socket. > > If we find that case, unlock, and retry again. Taking the write > lock would not be a problem in first place (apart from killing some > parallelism). However the retry is needed as later on based on > similar condition checks we do acquire the pcbinfo lock and if the > conditions have changed, we might find ourselves with a lock > inconsistency, hence at the end of the function when trying to > unlock, hitting the KASSERT. > > Reported by: syzbot+bdf4caa36f3ceeac198f@syzkaller.appspotmail.com > Reviewed by: markj > MFC after: 6 weeks > Event: Waterloo Hackathon 2019 Differential Revision: https://reviews.freebsd.org/D20338