All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	David Miller <davem@davemloft.net>,
	Willem de Bruijn <willemb@google.com>,
	Eric Dumazet <edumazet@google.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	jarno@ovn.org, philip.pettersson@gmail.com,
	weongyo.linux@gmail.com, netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller <syzkaller@googlegroups.com>
Subject: Re: net/packet: use-after-free in packet_rcv_fanout
Date: Thu, 9 Feb 2017 19:33:06 -0800	[thread overview]
Message-ID: <20170210033306.GA770@oracle.com> (raw)
In-Reply-To: <1486696765.7793.119.camel@edumazet-glaptop3.roam.corp.google.com>

On (02/09/17 19:19), Eric Dumazet wrote:
> 
> More likely the bug is in fanout_add(), with a buggy sequence in error
> case, and not correct locking.
> 
> kfree(po->rollover);
> po->rollover = NULL;
> 
> Two cpus entering fanout_add() (using the same af_packet socket,
> syzkaller courtesy...) might both see po->fanout being NULL.
> 
> Then they grab the mutex.  Too late...

I'm not sure I follow- aiui the panic was in acceessing the
sk_receive_queue.lock in a socket that had been closed earlier. I think
the assumption is that rcu_read_lock_bh in __dev_queue_xmit (and
rcu_read_lock in dev_queue_xmit_nit?) should make sure that the nit
packet delivery can be done safely, and the synchronize_net in
packet_release() makes sure that the Tx paths are quiesced before freeing
the socket.  What is the race-hole here? Does it have to do with the
_bh and softirq context, somehow?

--Sowmini

  parent reply	other threads:[~2017-02-10  3:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 13:14 net/packet: use-after-free in packet_rcv_fanout Dmitry Vyukov
2017-02-09 15:12 ` Sowmini Varadhan
2017-02-09 15:17   ` Eric Dumazet
2017-02-10  1:24 ` Cong Wang
2017-02-10  3:19   ` Eric Dumazet
2017-02-10  3:23     ` Eric Dumazet
2017-02-10 17:49       ` Cong Wang
2017-02-10 17:59         ` Eric Dumazet
2017-02-10 18:02           ` Cong Wang
2017-02-10 18:15             ` Eric Dumazet
2017-02-10 18:02           ` Eric Dumazet
2017-02-10 18:34             ` Cong Wang
2017-02-13  1:42             ` Sowmini Varadhan
2017-02-13 15:17               ` Dmitry Vyukov
2017-02-17 19:27                 ` Cong Wang
2017-02-10  3:33     ` Sowmini Varadhan [this message]
2017-02-10  4:18       ` Eric Dumazet
2017-02-10 18:00       ` Cong Wang
2017-02-10 19:16         ` Sowmini Varadhan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170210033306.GA770@oracle.com \
    --to=sowmini.varadhan@oracle.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jarno@ovn.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=philip.pettersson@gmail.com \
    --cc=syzkaller@googlegroups.com \
    --cc=weongyo.linux@gmail.com \
    --cc=willemb@google.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.