From owner-svn-src-head@freebsd.org Fri Dec 16 22:55:43 2016 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 588DEC838FA; Fri, 16 Dec 2016 22:55:43 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-qk0-x235.google.com (mail-qk0-x235.google.com [IPv6:2607:f8b0:400d:c09::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 14B2D9F6; Fri, 16 Dec 2016 22:55:43 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-qk0-x235.google.com with SMTP id q130so105897392qke.1; Fri, 16 Dec 2016 14:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jLpzvXsyO0EXyk2bE5CJteBjGBLrx4k9bonWB1jjuA4=; b=B/LsbqngOZfMjrtmFWh9TTmjIGbcXa63UL6hGjFk9XYbcZEv2x/7h6M6lkYVIi6xIy XTIYhcSSBeLBaUv48eGbiYOg0CU8QBkfEtodmnY8VeY9xFfZ6Y0HCKTqGIpIS2KXZKYs DBDyZz5Lv8rYALbarmbNpTPhB/V4QKibZ1U6mdcGGTuCRPprao0r8Qt1UP5ZSG4wtPJH sHc9AgMlVepYfr0PjNYS0Eak58V3dZHI/zbJ6pTBQ0KKR8kzG5XUEhmdm5DlwSfafHeN QmX3MdMzUdyJLqKaYqdeGvgUcxOoiQpY+2oYnNZLKqdYN+Uth43rlpfo/y6p2EbpVQFn lu9A== 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=jLpzvXsyO0EXyk2bE5CJteBjGBLrx4k9bonWB1jjuA4=; b=Gl3rBhTLcB13uN6VUnLns1OE0QlFuThxpQSDZqa6VUVt3Jaao7OOPmQJXMLPK1bYxs 7E3S9rb3ixG4V5pnrW0IU15DQbP5cTTWTXCtb+xxqIoslxpllQSQxqXJinpsRAk6zXOZ /JfGXxsz2ihY0nfCHFK/1eAS/jIedjKokUTnC8wmAMTVfCB5AuHcyAqEeq3hqnRLRdzv AiamhaZYK9cziTRghyjDhEBs56QDbsL1JA2U9ZSJ5tnuEKzZSy3ou4Wj/j6b7oQOcrdS 6H92zZqK25Lk+9Cp9B6sXVRH0Q2cLod4Pphyr1+r8XXDukfdCfDRaG4+JQ0oMhDkGBMo 9glw== X-Gm-Message-State: AIkVDXIycTjVV5VNe2U1WhRr7euhEaDelBmOOOKnFWstJ81RZNjz9kHCZo2JJ8JQZnBdqcrKU7Ru62Y8lfbAPg== X-Received: by 10.55.92.199 with SMTP id q190mr3362868qkb.303.1481928942197; Fri, 16 Dec 2016 14:55:42 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.12.181.208 with HTTP; Fri, 16 Dec 2016 14:55:41 -0800 (PST) In-Reply-To: <20161216224535.GA6408@dft-labs.eu> References: <201612162239.uBGMdVSL027853@repo.freebsd.org> <20161216224535.GA6408@dft-labs.eu> From: Alan Somers Date: Fri, 16 Dec 2016 15:55:41 -0700 X-Google-Sender-Auth: fQRE1bncW9FxX9ZFndAeIrSqjDU Message-ID: Subject: Re: svn commit: r310180 - head/sys/net To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 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: Fri, 16 Dec 2016 22:55:43 -0000 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".