Re: [tipc-discussion] memory leak in tipc_buf_acquire
On 6/10/19 2:44 AM, Xin Long wrote: > Looks we need to purge each member's deferredq list in tipc_group_delete(): > diff --git a/net/tipc/group.c b/net/tipc/group.c > index 992be61..23823eb 100644 > --- a/net/tipc/group.c > +++ b/net/tipc/group.c > @@ -218,6 +218,7 @@ void tipc_group_delete(struct net *net, struct > tipc_group *grp) > > rbtree_postorder_for_each_entry_safe(m, tmp, tree, tree_node) { > tipc_group_proto_xmit(grp, m, GRP_LEAVE_MSG, ); > + __skb_queue_purge(>deferredq); > list_del(>list); > kfree(m); > } Good catch! I agree with you. ___ tipc-discussion mailing list tipc-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tipc-discussion
Re: [tipc-discussion] memory leak in tipc_buf_acquire
> -Original Message- > From: netdev-ow...@vger.kernel.org On > Behalf Of Xin Long > Sent: 9-Jun-19 14:45 > To: syzbot > Cc: davem ; Jon Maloy ; > LKML ; network dev > ; syzkaller-bugs b...@googlegroups.com>; tipc-discussion@lists.sourceforge.net; Ying Xue > > Subject: Re: memory leak in tipc_buf_acquire > > On Sat, May 25, 2019 at 5:18 AM syzbot > wrote: > > > > Hello, > > > > syzbot found the following crash on: > > > > HEAD commit:4dde821e Merge tag 'xfs-5.2-fixes-1' of git://git.kernel.o.. > > git tree: upstream > > console output: > > https://protect2.fireeye.com/url?k=2a9bdca3-761109b5-2a9b9c38- > 862f14a9 > > 365e- > 4ed8fb52eb782aab=1=https%3A%2F%2Fsyzkaller.appspot.com%2Fx% > 2F > > log.txt%3Fx%3D107db73aa0 kernel config: > > https://protect2.fireeye.com/url?k=a1863015-fd0ce503-a186708e- > 862f14a9 > > 365e- > 04056f2111354660=1=https%3A%2F%2Fsyzkaller.appspot.com%2Fx% > 2F > > .config%3Fx%3D61dd9e15a761691d dashboard link: > > https://protect2.fireeye.com/url?k=ba923b23-e618ee35-ba927bb8- > 862f14a9365e- > 6187e2f343fe3a3e=1=https%3A%2F%2Fsyzkaller.appspot.com%2Fbug > %3Fextid%3D78fbe679c8ca8d264a8d > > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > > syz repro: https://protect2.fireeye.com/url?k=27ea1a58-7b60cf4e- > 27ea5ac3-862f14a9365e- > f17f13fb7f100fa1=1=https%3A%2F%2Fsyzkaller.appspot.com%2Fx%2 > Frepro.syz%3Fx%3D162bd84ca0 > > C reproducer: https://protect2.fireeye.com/url?k=dbe4799b-876eac8d- > dbe43900-862f14a9365e- > 787a755a5a1800d6=1=https%3A%2F%2Fsyzkaller.appspot.com%2Fx > %2Frepro.c%3Fx%3D160c605ca0 > > > Looks we need to purge each member's deferredq list in tipc_group_delete(): > diff --git a/net/tipc/group.c b/net/tipc/group.c index 992be61..23823eb > 100644 > --- a/net/tipc/group.c > +++ b/net/tipc/group.c > @@ -218,6 +218,7 @@ void tipc_group_delete(struct net *net, struct > tipc_group *grp) > > rbtree_postorder_for_each_entry_safe(m, tmp, tree, tree_node) { > tipc_group_proto_xmit(grp, m, GRP_LEAVE_MSG, ); > + __skb_queue_purge(>deferredq); > list_del(>list); > kfree(m); > } Yes, I think you are right. I'll check it further. Thanks ///jon > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > > Reported-by: syzbot+78fbe679c8ca8d264...@syzkaller.appspotmail.com > > > > type=1400 audit(1558701681.775:36): avc: denied { map } for > > pid=7128 comm="syz-executor987" path="/root/syz-executor987656147" > dev="sda1" > > ino=15900 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 > > tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 > > executing program executing program executing program executing > > program > > BUG: memory leak > > unreferenced object 0x88810df83c00 (size 512): > >comm "softirq", pid 0, jiffies 4294942354 (age 19.830s) > >hex dump (first 32 bytes): > > 38 1a 0d 0f 81 88 ff ff 38 1a 0d 0f 81 88 ff ff 8...8... > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > >backtrace: > > [<9375ee42>] kmemleak_alloc_recursive > > include/linux/kmemleak.h:55 [inline] > > [<9375ee42>] slab_post_alloc_hook mm/slab.h:439 [inline] > > [<9375ee42>] slab_alloc_node mm/slab.c:3269 [inline] > > [<9375ee42>] kmem_cache_alloc_node+0x153/0x2a0 > mm/slab.c:3579 > > [<4c563922>] __alloc_skb+0x6e/0x210 net/core/skbuff.c:198 > > [] alloc_skb_fclone include/linux/skbuff.h:1107 > > [inline] > > [ ] tipc_buf_acquire+0x2f/0x80 net/tipc/msg.c:66 > > [ ] tipc_msg_create+0x37/0xe0 net/tipc/msg.c:98 > > [<8bb437b0>] tipc_group_create_event+0xb3/0x1b0 > > net/tipc/group.c:679 > > [<947b1d0f>] tipc_group_proto_rcv+0x569/0x640 > > net/tipc/group.c:781 > > [ ] tipc_sk_proto_rcv net/tipc/socket.c:1996 > [inline] > > [ ] tipc_sk_filter_rcv+0x9ac/0xf20 > > net/tipc/socket.c:2163 > > [<0dab7a6c>] tipc_sk_enqueue net/tipc/socket.c:2255 [inline] > > [<0dab7a6c>] tipc_sk_rcv+0x494/0x8a0 > net/tipc/socket.c:2306 > > [<023a7ddd>] tipc_node_xmit+0x196/0x1f0 > net/tipc/node.c:1442 > > [<337dd9eb>] tipc_node_xmit_skb net/tipc/node.c:1491 > [inline] > > [<337dd9eb>] tipc_node_distr_xmit+0x7d/0x120 > > net/tipc/node.c:1506 > > [ ] tipc_group_delete+0xe6/0x130 > net/tipc/group.c:224 > > [<0361ba2b>] tipc_sk_leave+0x57/0xb0 > net/tipc/socket.c:2925 > > [<9df90505>] tipc_release+0x7b/0x5e0 net/tipc/socket.c:584 > > [<9f3189da>] __sock_release+0x4b/0xe0 net/socket.c:607 > > [ ] sock_close+0x1b/0x30 net/socket.c:1279 > > [<266a6215>] __fput+0xed/0x300 fs/file_table.c:280 > > > > BUG: memory leak > > unreferenced object 0x888111895400 (size 1024): > >comm "softirq", pid 0,
Re: [tipc-discussion] memory leak in tipc_buf_acquire
On Sat, May 25, 2019 at 5:18 AM syzbot wrote: > > Hello, > > syzbot found the following crash on: > > HEAD commit:4dde821e Merge tag 'xfs-5.2-fixes-1' of git://git.kernel.o.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=107db73aa0 > kernel config: https://syzkaller.appspot.com/x/.config?x=61dd9e15a761691d > dashboard link: https://syzkaller.appspot.com/bug?extid=78fbe679c8ca8d264a8d > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=162bd84ca0 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=160c605ca0 > Looks we need to purge each member's deferredq list in tipc_group_delete(): diff --git a/net/tipc/group.c b/net/tipc/group.c index 992be61..23823eb 100644 --- a/net/tipc/group.c +++ b/net/tipc/group.c @@ -218,6 +218,7 @@ void tipc_group_delete(struct net *net, struct tipc_group *grp) rbtree_postorder_for_each_entry_safe(m, tmp, tree, tree_node) { tipc_group_proto_xmit(grp, m, GRP_LEAVE_MSG, ); + __skb_queue_purge(>deferredq); list_del(>list); kfree(m); } > IMPORTANT: if you fix the bug, please add the following tag to the commit: > Reported-by: syzbot+78fbe679c8ca8d264...@syzkaller.appspotmail.com > > type=1400 audit(1558701681.775:36): avc: denied { map } for pid=7128 > comm="syz-executor987" path="/root/syz-executor987656147" dev="sda1" > ino=15900 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 > tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 > executing program > executing program > executing program > executing program > BUG: memory leak > unreferenced object 0x88810df83c00 (size 512): >comm "softirq", pid 0, jiffies 4294942354 (age 19.830s) >hex dump (first 32 bytes): > 38 1a 0d 0f 81 88 ff ff 38 1a 0d 0f 81 88 ff ff 8...8... > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >backtrace: > [<9375ee42>] kmemleak_alloc_recursive > include/linux/kmemleak.h:55 [inline] > [<9375ee42>] slab_post_alloc_hook mm/slab.h:439 [inline] > [<9375ee42>] slab_alloc_node mm/slab.c:3269 [inline] > [<9375ee42>] kmem_cache_alloc_node+0x153/0x2a0 mm/slab.c:3579 > [<4c563922>] __alloc_skb+0x6e/0x210 net/core/skbuff.c:198 > [] alloc_skb_fclone include/linux/skbuff.h:1107 > [inline] > [ ] tipc_buf_acquire+0x2f/0x80 net/tipc/msg.c:66 > [ ] tipc_msg_create+0x37/0xe0 net/tipc/msg.c:98 > [<8bb437b0>] tipc_group_create_event+0xb3/0x1b0 > net/tipc/group.c:679 > [<947b1d0f>] tipc_group_proto_rcv+0x569/0x640 > net/tipc/group.c:781 > [ ] tipc_sk_proto_rcv net/tipc/socket.c:1996 [inline] > [ ] tipc_sk_filter_rcv+0x9ac/0xf20 > net/tipc/socket.c:2163 > [<0dab7a6c>] tipc_sk_enqueue net/tipc/socket.c:2255 [inline] > [<0dab7a6c>] tipc_sk_rcv+0x494/0x8a0 net/tipc/socket.c:2306 > [<023a7ddd>] tipc_node_xmit+0x196/0x1f0 net/tipc/node.c:1442 > [<337dd9eb>] tipc_node_xmit_skb net/tipc/node.c:1491 [inline] > [<337dd9eb>] tipc_node_distr_xmit+0x7d/0x120 > net/tipc/node.c:1506 > [ ] tipc_group_delete+0xe6/0x130 net/tipc/group.c:224 > [<0361ba2b>] tipc_sk_leave+0x57/0xb0 net/tipc/socket.c:2925 > [<9df90505>] tipc_release+0x7b/0x5e0 net/tipc/socket.c:584 > [<9f3189da>] __sock_release+0x4b/0xe0 net/socket.c:607 > [ ] sock_close+0x1b/0x30 net/socket.c:1279 > [<266a6215>] __fput+0xed/0x300 fs/file_table.c:280 > > BUG: memory leak > unreferenced object 0x888111895400 (size 1024): >comm "softirq", pid 0, jiffies 4294942354 (age 19.830s) >hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >backtrace: > [ ] kmemleak_alloc_recursive > include/linux/kmemleak.h:55 [inline] > [ ] slab_post_alloc_hook mm/slab.h:439 [inline] > [ ] slab_alloc_node mm/slab.c:3269 [inline] > [ ] kmem_cache_alloc_node_trace+0x15b/0x2a0 > mm/slab.c:3597 > [ ] __do_kmalloc_node mm/slab.c:3619 [inline] > [ ] __kmalloc_node_track_caller+0x38/0x50 > mm/slab.c:3634 > [<39212451>] __kmalloc_reserve.isra.0+0x40/0xb0 > net/core/skbuff.c:142 > [<307cb4cf>] __alloc_skb+0xa0/0x210 net/core/skbuff.c:210 > [ ] alloc_skb_fclone include/linux/skbuff.h:1107 > [inline] > [ ] tipc_buf_acquire+0x2f/0x80 net/tipc/msg.c:66 > [ ] tipc_msg_create+0x37/0xe0 net/tipc/msg.c:98 > [<8bb437b0>] tipc_group_create_event+0xb3/0x1b0 > net/tipc/group.c:679 >