KASAN: use-after-free Read in xfrm6_tunnel_destroy

20 views
Skip to first unread message

syzbot

unread,
Apr 12, 2019, 12:12:11 AM4/12/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 1ec8f1f0 Linux 4.14.111
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1715a0f3200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=74900e5257bb7d5c7cc3
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+74900e...@syzkaller.appspotmail.com

autofs4:pid:27829:validate_dev_ioctl: invalid device control module version
supplied for cmd(0x00009375)
==================================================================
BUG: KASAN: use-after-free in xfrm6_tunnel_free_spi
net/ipv6/xfrm6_tunnel.c:208 [inline]
BUG: KASAN: use-after-free in xfrm6_tunnel_destroy+0x52e/0x5d0
net/ipv6/xfrm6_tunnel.c:303
Read of size 8 at addr ffff888072d8c2b8 by task kworker/1:0/18

CPU: 1 PID: 18 Comm: kworker/1:0 Not tainted 4.14.111 #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events xfrm_state_gc_task
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xaf/0x2b5 mm/kasan/report.c:393
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
xfrm6_tunnel_free_spi net/ipv6/xfrm6_tunnel.c:208 [inline]
xfrm6_tunnel_destroy+0x52e/0x5d0 net/ipv6/xfrm6_tunnel.c:303
xfrm_state_gc_destroy net/xfrm/xfrm_state.c:449 [inline]
xfrm_state_gc_task+0x3ef/0x660 net/xfrm/xfrm_state.c:470
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Allocated by task 7131:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15d/0x7a0 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
kzalloc include/linux/slab.h:661 [inline]
ops_init+0xee/0x3d0 net/core/net_namespace.c:108
setup_net+0x223/0x520 net/core/net_namespace.c:294
copy_net_ns+0x19f/0x440 net/core/net_namespace.c:418
create_new_namespaces+0x37b/0x720 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:206
SYSC_unshare kernel/fork.c:2379 [inline]
SyS_unshare+0x2f3/0x7e0 kernel/fork.c:2329
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 2240:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
ops_free net/core/net_namespace.c:132 [inline]
ops_free_list.part.0+0x1f6/0x320 net/core/net_namespace.c:154
ops_free_list net/core/net_namespace.c:152 [inline]
cleanup_net+0x458/0x870 net/core/net_namespace.c:487
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

The buggy address belongs to the object at ffff888072d8c200
which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 184 bytes inside of
8192-byte region [ffff888072d8c200, ffff888072d8e200)
The buggy address belongs to the page:
page:ffffea0001cb6300 count:1 mapcount:0 mapping:ffff888072d8c200 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff888072d8c200 0000000000000000 0000000100000001
raw: ffffea0001cb5d20 ffffea0001cb6e20 ffff8880aa802080 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888072d8c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888072d8c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff888072d8c280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888072d8c300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888072d8c380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Apr 16, 2019, 4:49:07 PM4/16/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 1ec8f1f0 Linux 4.14.111
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=153eede3200000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdadf290ea9fc6f9
dashboard link: https://syzkaller.appspot.com/bug?extid=74900e5257bb7d5c7cc3
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1171952d200000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+74900e...@syzkaller.appspotmail.com

team0 (unregistering): Port device team_slave_0 removed
bond0 (unregistering): Releasing backup interface bond_slave_1
bond0 (unregistering): Releasing backup interface bond_slave_0
bond0 (unregistering): Released all slaves
==================================================================
BUG: KASAN: use-after-free in xfrm6_tunnel_free_spi
net/ipv6/xfrm6_tunnel.c:208 [inline]
BUG: KASAN: use-after-free in xfrm6_tunnel_destroy+0x52e/0x5d0
net/ipv6/xfrm6_tunnel.c:303
Read of size 8 at addr ffff8880913623b8 by task kworker/0:4/7091

CPU: 0 PID: 7091 Comm: kworker/0:4 Not tainted 4.14.111 #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events xfrm_state_gc_task
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xaf/0x2b5 mm/kasan/report.c:393
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
xfrm6_tunnel_free_spi net/ipv6/xfrm6_tunnel.c:208 [inline]
xfrm6_tunnel_destroy+0x52e/0x5d0 net/ipv6/xfrm6_tunnel.c:303
xfrm_state_gc_destroy net/xfrm/xfrm_state.c:449 [inline]
xfrm_state_gc_task+0x3ef/0x660 net/xfrm/xfrm_state.c:470
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Allocated by task 7072:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15d/0x7a0 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
kzalloc include/linux/slab.h:661 [inline]
ops_init+0xee/0x3d0 net/core/net_namespace.c:108
setup_net+0x223/0x520 net/core/net_namespace.c:294
copy_net_ns+0x19f/0x440 net/core/net_namespace.c:418
create_new_namespaces+0x37b/0x720 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:206
SYSC_unshare kernel/fork.c:2379 [inline]
SyS_unshare+0x2f3/0x7e0 kernel/fork.c:2329
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 2286:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
ops_free net/core/net_namespace.c:132 [inline]
ops_free_list.part.0+0x1f6/0x320 net/core/net_namespace.c:154
ops_free_list net/core/net_namespace.c:152 [inline]
cleanup_net+0x458/0x870 net/core/net_namespace.c:487
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

The buggy address belongs to the object at ffff888091361bc0
which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 2040 bytes inside of
8192-byte region [ffff888091361bc0, ffff888091363bc0)
The buggy address belongs to the page:
page:ffffea000244d800 count:1 mapcount:0 mapping:ffff888091361bc0 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff888091361bc0 0000000000000000 0000000100000001
raw: ffffea000208fa20 ffffea0002082120 ffff8880aa802080 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888091362280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888091362300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff888091362380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888091362400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888091362480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

syzbot

unread,
Apr 28, 2019, 5:36:07 PM4/28/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: fa5941f4 Linux 4.14.114
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17dd3a14a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=d7780000df8e070e
dashboard link: https://syzkaller.appspot.com/bug?extid=74900e5257bb7d5c7cc3
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10af3504a00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=133ee388a00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+74900e...@syzkaller.appspotmail.com

IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in xfrm6_tunnel_free_spi
net/ipv6/xfrm6_tunnel.c:208 [inline]
BUG: KASAN: use-after-free in xfrm6_tunnel_destroy+0x52e/0x5d0
net/ipv6/xfrm6_tunnel.c:303
Read of size 8 at addr ffff8880803956f8 by task kworker/0:2/3144

CPU: 0 PID: 3144 Comm: kworker/0:2 Not tainted 4.14.114 #4
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events xfrm_state_gc_task
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xaf/0x2b5 mm/kasan/report.c:393
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
xfrm6_tunnel_free_spi net/ipv6/xfrm6_tunnel.c:208 [inline]
xfrm6_tunnel_destroy+0x52e/0x5d0 net/ipv6/xfrm6_tunnel.c:303
xfrm_state_gc_destroy net/xfrm/xfrm_state.c:449 [inline]
xfrm_state_gc_task+0x3ef/0x660 net/xfrm/xfrm_state.c:470
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Allocated by task 6993:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15d/0x7a0 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
kzalloc include/linux/slab.h:661 [inline]
ops_init+0xee/0x3d0 net/core/net_namespace.c:108
setup_net+0x237/0x530 net/core/net_namespace.c:295
copy_net_ns+0x19f/0x440 net/core/net_namespace.c:419
create_new_namespaces+0x37b/0x720 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:206
SYSC_unshare kernel/fork.c:2379 [inline]
SyS_unshare+0x2f3/0x7e0 kernel/fork.c:2329
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 2283:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
ops_free net/core/net_namespace.c:132 [inline]
ops_free_list.part.0+0x1f6/0x320 net/core/net_namespace.c:154
ops_free_list net/core/net_namespace.c:152 [inline]
cleanup_net+0x458/0x880 net/core/net_namespace.c:488
process_one_work+0x868/0x1610 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x31c/0x430 kernel/kthread.c:232
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

The buggy address belongs to the object at ffff888080395640
which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 184 bytes inside of
8192-byte region [ffff888080395640, ffff888080397640)
The buggy address belongs to the page:
page:ffffea000200e500 count:1 mapcount:0 mapping:ffff888080395640 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff888080395640 0000000000000000 0000000100000001
raw: ffffea000282c820 ffffea0002839e20 ffff8880aa802080 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888080395580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888080395600: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
> ffff888080395680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888080395700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888080395780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages