From owner-svn-src-head@freebsd.org Sun Jan 1 10:26:40 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 A8ED6C9A62A; Sun, 1 Jan 2017 10:26:40 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wj0-x241.google.com (mail-wj0-x241.google.com [IPv6:2a00:1450:400c:c01::241]) (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 2AFB11F68; Sun, 1 Jan 2017 10:26:40 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wj0-x241.google.com with SMTP id qs7so27924928wjc.1; Sun, 01 Jan 2017 02:26:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gje235liaGBA0vNxXNL6x+JswW/0wAU1j5J82YdvKnM=; b=D2O21aNt4Sp39GX9Kj7IKSdZXueJjX7irMradvHxGs9v6ZPHFatzy/aFwpMAg1K+9j d7s3HY7gYUvJQYvWEeYqzFk0D4bYfKTyPm+pTJFESobc6iR+1YRWp+h8/2M8gK2vYfcl jq8ilQMEDQAor8z6/YwKMz3P1Fi1m0LYj+Io5zbg1yYKmcDy+9y35keC6Gwf+6kbxybp UTpYJHEmGRKLuJjFg7GTNuYnVsrVs4TXwNSWkSRSGvLChrFyNWsmdimYdVA4WBocO3UO 4BTTLoXySLimwFvn7dIACXMD2hUyIdsPEkBDCRlu1UiM7GwG559Wd9nP54Vzz1lYnyV1 zMlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gje235liaGBA0vNxXNL6x+JswW/0wAU1j5J82YdvKnM=; b=h+zM8Svja/Xqag5Z+xnu4iyU/wbqvatm9wva1dYlo3YbkUXINTgrMnjMD/WHNIguqx C5C7dj4xYFXF7DvBPwa6TRgZsT54UOAgD8L+i260Varf4bYcuwBuUOkNUXMlvFCqvPL2 aIKDDUgjsJ5NhPjKzz8pQLIA+gKOh2KRKW2Ljj/n/LWAiuih0YcpLjrJoqp7ZuIJ3y3M ISI5oFvueAjKNIVj4RBUJsy6aqw6GsLf/9Ai3AO8kt1s9tZZ9qldPXiE9WFSyvwhJf5W DoeiTK6zTQHC+SR8QsM/6vjTfZsqNd2lEYDgNVKTWFPrrzz6PbphA0ArtXletu64ldMk RDGg== X-Gm-Message-State: AIkVDXLAMdBnrrIxIEA9wJ627jEx6QrhyzvZmwnckoPuW6XW9IbHC/F5iM0xK3XfJc3D3w== X-Received: by 10.194.123.103 with SMTP id lz7mr53035442wjb.100.1483266398312; Sun, 01 Jan 2017 02:26:38 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id c133sm79365261wme.12.2017.01.01.02.26.37 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 01 Jan 2017 02:26:37 -0800 (PST) Date: Sun, 1 Jan 2017 11:26:35 +0100 From: Mateusz Guzik To: Alan Somers Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310180 - head/sys/net Message-ID: <20170101102635.GB24150@dft-labs.eu> References: <201612162239.uBGMdVSL027853@repo.freebsd.org> <20161216224535.GA6408@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: Sun, 01 Jan 2017 10:26:40 -0000 On Fri, Dec 16, 2016 at 03:55:41PM -0700, Alan Somers wrote: > On Fri, Dec 16, 2016 at 3:45 PM, Mateusz Guzik wrote: > > On Fri, Dec 16, 2016 at 10:39:31PM +0000, Alan Somers wrote: > >> Author: asomers > >> Date: Fri Dec 16 22:39:30 2016 > >> New Revision: 310180 > >> URL: https://svnweb.freebsd.org/changeset/base/310180 > >> > >> Log: > >> Fix panic during lagg destruction with simultaneous status check > >> > >> If you run "ifconfig lagg0 destroy" and "ifconfig lagg0" at the same time a > >> page fault may result. The first process will destroy ifp->if_lagg in > >> lagg_clone_destroy (called by if_clone_destroy). Then the second process > >> will observe that ifp->if_lagg is NULL at the top of lagg_port_ioctl and > >> goto fallback: where it will promptly dereference ifp->if_lagg anyway. > >> > >> The solution is to repeat the NULL check for ifp->if_lagg > >> > > > > I don't understand how this solves the problem. What prevents the object > > from getting freed after the pointer got NULLified? That is, it seems > > the patch turns a null pointer deref into a use-after-free. > > > > There seems to be a refcounting issue here. > > > > That said, I only did cursory reading. > > What object are you talking about? The problem solved by this commit > is the null-pointer dereference in the thread calling lagg_port_ioctl, > for example "ifconfig lagg0". I misread the patch, sorry for the noise. -- Mateusz Guzik