netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ast@kernel.org
Cc: daniel@iogearbox.net, netdev@vger.kernel.org, dvyukov@google.com,
	willy@infradead.org, kernel-team@fb.com
Subject: Re: [PATCH net] bpfilter: fix race in pipe access
Date: Thu, 07 Jun 2018 20:07:52 -0400 (EDT)	[thread overview]
Message-ID: <20180607.200752.284768085796877308.davem@davemloft.net> (raw)
In-Reply-To: <20180607223114.189970-1-ast@kernel.org>

From: Alexei Starovoitov <ast@kernel.org>
Date: Thu, 7 Jun 2018 15:31:14 -0700

> syzbot reported the following crash
> [  338.293946] bpfilter: read fail -512
> [  338.304515] kasan: GPF could be caused by NULL-ptr deref or user memory access
> [  338.311863] general protection fault: 0000 [#1] SMP KASAN
> [  338.344360] RIP: 0010:__vfs_write+0x4a6/0x960
> [  338.426363] Call Trace:
> [  338.456967]  __kernel_write+0x10c/0x380
> [  338.460928]  __bpfilter_process_sockopt+0x1d8/0x35b
> [  338.487103]  bpfilter_mbox_request+0x4d/0xb0
> [  338.491492]  bpfilter_ip_get_sockopt+0x6b/0x90
> 
> This can happen when multiple cpus trying to talk to user mode process
> via bpfilter_mbox_request(). One cpu grabs the mutex while another goes to
> sleep on the same mutex. Then former cpu sees that umh pipe is down and
> shuts down the pipes. Later cpu finally acquires the mutex and crashes
> on freed pipe.
> Fix the race by using info.pid as an indicator that umh and pipes are healthy
> and check it after acquiring the mutex.
> 
> Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
> Reported-by: syzbot+7ade6c94abb2774c0fee@syzkaller.appspotmail.com
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Applied, thanks Alexei.

      reply	other threads:[~2018-06-08  0:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 22:31 [PATCH net] bpfilter: fix race in pipe access Alexei Starovoitov
2018-06-08  0:07 ` David Miller [this message]

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=20180607.200752.284768085796877308.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dvyukov@google.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).