netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	syzbot+f31660cf279b0557160c@syzkaller.appspotmail.com
Subject: Re: [PATCH nf] netfilter: nf_tables: unlink table before deleting it
Date: Tue, 21 Sep 2021 03:47:32 +0200	[thread overview]
Message-ID: <YUk5tHTsPmkqHK6E@salvia> (raw)
In-Reply-To: <20210913124233.16520-1-fw@strlen.de>

On Mon, Sep 13, 2021 at 02:42:33PM +0200, Florian Westphal wrote:
> syzbot reports following UAF:
> BUG: KASAN: use-after-free in memcmp+0x18f/0x1c0 lib/string.c:955
>  nla_strcmp+0xf2/0x130 lib/nlattr.c:836
>  nft_table_lookup.part.0+0x1a2/0x460 net/netfilter/nf_tables_api.c:570
>  nft_table_lookup net/netfilter/nf_tables_api.c:4064 [inline]
>  nf_tables_getset+0x1b3/0x860 net/netfilter/nf_tables_api.c:4064
>  nfnetlink_rcv_msg+0x659/0x13f0 net/netfilter/nfnetlink.c:285
>  netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504
> 
> Problem is that all get operations are lockless, so the commit_mutex
> held by nft_rcv_nl_event() isn't enough to stop a parallel GET request
> from doing read-accesses to the table object even after synchronize_rcu().
> 
> To avoid this, unlink the table first and store the table objects in
> on-stack scratch space.

Applied, thanks.

      reply	other threads:[~2021-09-21  1:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  7:35 [syzbot] KASAN: use-after-free Read in nft_table_lookup (2) syzbot
2021-09-13 12:42 ` [PATCH nf] netfilter: nf_tables: unlink table before deleting it Florian Westphal
2021-09-21  1:47   ` Pablo Neira Ayuso [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=YUk5tHTsPmkqHK6E@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=syzbot+f31660cf279b0557160c@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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 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).