From: Cong Wang <xiyou.wangcong@gmail.com>
To: syzbot <syzbot+4c3cc6dbe7259dbf9054@syzkaller.appspotmail.com>
Cc: Arvid Brodin <arvid.brodin@alten.se>,
coreteam@netfilter.org, David Miller <davem@davemloft.net>,
florent.fourcot@wifirst.fr, Florian Westphal <fw@strlen.de>,
jeremy@azazel.net, Johannes Berg <johannes.berg@intel.com>,
kadlec@netfilter.org, LKML <linux-kernel@vger.kernel.org>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
NetFilter <netfilter-devel@vger.kernel.org>,
Pablo Neira Ayuso <pablo@netfilter.org>,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: KASAN: use-after-free Read in bitmap_port_ext_cleanup
Date: Fri, 10 Jan 2020 11:09:16 -0800 [thread overview]
Message-ID: <CAM_iQpWz+ivP2vS50rY94DiR6qSh1W0WKjqgBNKYpUH_VFPgGw@mail.gmail.com> (raw)
In-Reply-To: <000000000000f744e0059bcd8216@google.com>
On Fri, Jan 10, 2020 at 10:44 AM syzbot
<syzbot+4c3cc6dbe7259dbf9054@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: b07f636f Merge tag 'tpmdd-next-20200108' of git://git.infr..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16c03259e00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=18698c0c240ba616
> dashboard link: https://syzkaller.appspot.com/bug?extid=4c3cc6dbe7259dbf9054
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> userspace arch: i386
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10c365c6e00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=117df9e1e00000
>
> The bug was bisected to:
>
> commit b9a1e627405d68d475a3c1f35e685ccfb5bbe668
> Author: Cong Wang <xiyou.wangcong@gmail.com>
> Date: Thu Jul 4 00:21:13 2019 +0000
>
> hsr: implement dellink to clean up resources
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=118759e1e00000
> final crash: https://syzkaller.appspot.com/x/report.txt?x=138759e1e00000
> console output: https://syzkaller.appspot.com/x/log.txt?x=158759e1e00000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+4c3cc6dbe7259dbf9054@syzkaller.appspotmail.com
> Fixes: b9a1e627405d ("hsr: implement dellink to clean up resources")
>
> ==================================================================
> BUG: KASAN: use-after-free in test_bit
> include/asm-generic/bitops/instrumented-non-atomic.h:110 [inline]
> BUG: KASAN: use-after-free in bitmap_port_ext_cleanup+0xe6/0x2a0
> net/netfilter/ipset/ip_set_bitmap_gen.h:51
> Read of size 8 at addr ffff8880a87a47c0 by task syz-executor559/9563
>
> CPU: 0 PID: 9563 Comm: syz-executor559 Not tainted 5.5.0-rc5-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x197/0x210 lib/dump_stack.c:118
> print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
> __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
> kasan_report+0x12/0x20 mm/kasan/common.c:639
> check_memory_region_inline mm/kasan/generic.c:185 [inline]
> check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192
> __kasan_check_read+0x11/0x20 mm/kasan/common.c:95
> test_bit include/asm-generic/bitops/instrumented-non-atomic.h:110 [inline]
> bitmap_port_ext_cleanup+0xe6/0x2a0
map->members is freed by ip_set_free() right before using it in
mtype_ext_cleanup() again. So I think probably we just have to
move it down:
diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h
b/net/netfilter/ipset/ip_set_bitmap_gen.h
index 1abd6f0dc227..077a2cb65fcb 100644
--- a/net/netfilter/ipset/ip_set_bitmap_gen.h
+++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
@@ -60,9 +60,9 @@ mtype_destroy(struct ip_set *set)
if (SET_WITH_TIMEOUT(set))
del_timer_sync(&map->gc);
- ip_set_free(map->members);
if (set->dsize && set->extensions & IPSET_EXT_DESTROY)
mtype_ext_cleanup(set);
+ ip_set_free(map->members);
ip_set_free(map);
set->data = NULL;
Thanks.
next prev parent reply other threads:[~2020-01-10 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 18:44 KASAN: use-after-free Read in bitmap_port_ext_cleanup syzbot
2020-01-10 19:09 ` Cong Wang [this message]
2020-01-10 19:13 ` Kadlecsik József
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=CAM_iQpWz+ivP2vS50rY94DiR6qSh1W0WKjqgBNKYpUH_VFPgGw@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=arvid.brodin@alten.se \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=florent.fourcot@wifirst.fr \
--cc=fw@strlen.de \
--cc=jeremy@azazel.net \
--cc=johannes.berg@intel.com \
--cc=kadlec@netfilter.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=syzbot+4c3cc6dbe7259dbf9054@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).