KASAN: use-after-free Write in skb_dequeue

12 views
Skip to first unread message

syzbot

unread,
Dec 4, 2019, 4:00:09 PM12/4/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: fbc5fe7a Linux 4.14.157
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10ce7e41e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=253d29a660cb0d
dashboard link: https://syzkaller.appspot.com/bug?extid=cc17f4103a61a12c02cb
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+cc17f4...@syzkaller.appspotmail.com

Node 1 Normal free:26224kB min:53508kB low:66884kB high:80260kB
active_anon:2843240kB inactive_anon:16kB active_file:1444kB
inactive_file:1340kB unevictable:0kB writepending:140kB present:3932160kB
managed:3870192kB mlocked:0kB kernel_stack:45344kB pagetables:99992kB
bounce:0kB free_pcp:1072kB local_pcp:740kB free_cma:0kB
==================================================================
BUG: KASAN: use-after-free in __write_once_size
include/linux/compiler.h:210 [inline]
BUG: KASAN: use-after-free in __skb_unlink include/linux/skbuff.h:1886
[inline]
BUG: KASAN: use-after-free in __skb_dequeue include/linux/skbuff.h:1903
[inline]
BUG: KASAN: use-after-free in skb_dequeue+0x174/0x180 net/core/skbuff.c:2817
Write of size 8 at addr ffff888024d84b88 by task kswapd0/1446

CPU: 1 PID: 1446 Comm: kswapd0 Not tainted 4.14.157-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x142/0x197 lib/dump_stack.c:58
lowmem_reserve[]:
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
0 0
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
__asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:435
__write_once_size include/linux/compiler.h:210 [inline]
__skb_unlink include/linux/skbuff.h:1886 [inline]
__skb_dequeue include/linux/skbuff.h:1903 [inline]
skb_dequeue+0x174/0x180 net/core/skbuff.c:2817
skb_queue_purge+0x26/0x40 net/core/skbuff.c:2854
0
nr_clear_queues+0x3d/0x40 net/netrom/nr_subr.c:41
nr_disconnect+0x3a/0x18f net/netrom/nr_subr.c:269
0
nr_state3_machine net/netrom/nr_in.c:168 [inline]
nr_process_rx_frame+0x8f8/0x1440 net/netrom/nr_in.c:298
0
nr_rx_frame+0x38b/0x1f70 net/netrom/af_netrom.c:930
nr_loopback_timer+0x75/0x150 net/netrom/nr_loopback.c:62
call_timer_fn+0x161/0x670 kernel/time/timer.c:1279
Node 0 DMA:
expire_timers kernel/time/timer.c:1318 [inline]
__run_timers kernel/time/timer.c:1636 [inline]
__run_timers kernel/time/timer.c:1604 [inline]
run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649
5*4kB (UM)
15*8kB
(UM)
__do_softirq+0x244/0x9a0 kernel/softirq.c:288
invoke_softirq kernel/softirq.c:368 [inline]
irq_exit+0x160/0x1b0 kernel/softirq.c:409
exiting_irq arch/x86/include/asm/apic.h:648 [inline]
smp_apic_timer_interrupt+0x146/0x5e0 arch/x86/kernel/apic/apic.c:1102
apic_timer_interrupt+0x96/0xa0 arch/x86/entry/entry_64.S:792
</IRQ>
RIP: 0010:schedule_debug kernel/sched/core.c:3198 [inline]
RIP: 0010:__schedule+0xe5/0x1cd0 kernel/sched/core.c:3308
RSP: 0018:ffff8880a66b7230 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff10
RAX: dffffc0000000000 RBX: ffff8880a66b0000 RCX: 1ffff11014cd554c
RDX: 1ffff11014cd543b RSI: ffffffff8703f940 RDI: ffff8880a66aa1d8
RBP: ffff8880a66b72d8 R08: 0000021c445a30ff R09: ffff8880a66aaa60
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001
R13: 000000000002b540 R14: ffff8880a66aa1c0 R15: ffff8880aed2b540
preempt_schedule_irq+0xb5/0x140 kernel/sched/core.c:3611
retint_kernel+0x1b/0x2d
RIP: 0010:try_to_unmap_one+0x11ff/0x1db0 mm/rmap.c:1334
RSP: 0018:ffff8880a66b73c8 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: ffffed1014cd6e8d RBX: dffffc0000000000 RCX: 1ffff11014cd5546
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff88015028
RBP: ffff8880a66b7570 R08: ffff8880a66aa1c0 R09: 0000000000000001
R10: 0000000000000000 R11: ffff8880a66aa1c0 R12: ffff888035d5a640
R13: 0000000000000001 R14: ffff8880a66b7548 R15: ffff888035d5a640
rmap_walk_file+0x38d/0x8b0 mm/rmap.c:1829
rmap_walk+0xed/0x190 mm/rmap.c:1847
try_to_unmap+0x2dc/0x3c0 mm/rmap.c:1666
shrink_page_list+0x1004/0x2d70 mm/vmscan.c:1197
shrink_inactive_list+0x46a/0xf40 mm/vmscan.c:1825
shrink_list mm/vmscan.c:2177 [inline]
shrink_node_memcg+0x8fb/0x11c0 mm/vmscan.c:2442
shrink_node+0x303/0xc40 mm/vmscan.c:2634
kswapd_shrink_node mm/vmscan.c:3296 [inline]
balance_pgdat mm/vmscan.c:3402 [inline]
kswapd+0x8fb/0x1600 mm/vmscan.c:3620
kthread+0x319/0x430 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 8491:
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
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc_node+0x144/0x780 mm/slab.c:3642
__alloc_skb+0x9c/0x500 net/core/skbuff.c:193
alloc_skb include/linux/skbuff.h:980 [inline]
nr_loopback_queue+0x53/0x220 net/netrom/nr_loopback.c:37
nr_route_frame+0x5c9/0x85a net/netrom/nr_route.c:799
nr_transmit_buffer+0x127/0x190 net/netrom/nr_out.c:212
nr_send_iframe net/netrom/nr_out.c:97 [inline]
nr_kick.part.0+0x31d/0x5a0 net/netrom/nr_out.c:169
nr_kick net/netrom/nr_out.c:134 [inline]
nr_output+0x55b/0x6a0 net/netrom/nr_out.c:75
nr_sendmsg+0x859/0xac0 net/netrom/af_netrom.c:1135
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xce/0x110 net/socket.c:656
sock_write_iter+0x21d/0x390 net/socket.c:925
call_write_iter include/linux/fs.h:1777 [inline]
new_sync_write fs/read_write.c:469 [inline]
__vfs_write+0x4a7/0x6b0 fs/read_write.c:482
vfs_write+0x198/0x500 fs/read_write.c:544
SYSC_write fs/read_write.c:590 [inline]
SyS_write+0xfd/0x230 fs/read_write.c:582
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 1446:
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]
kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
kfree_skbmem+0xa5/0x110 net/core/skbuff.c:586
__kfree_skb net/core/skbuff.c:646 [inline]
kfree_skb+0xbd/0x350 net/core/skbuff.c:663
skb_queue_purge+0x19/0x40 net/core/skbuff.c:2855
nr_clear_queues+0x31/0x40 net/netrom/nr_subr.c:40
nr_disconnect+0x3a/0x18f net/netrom/nr_subr.c:269
nr_state3_machine net/netrom/nr_in.c:168 [inline]
nr_process_rx_frame+0x8f8/0x1440 net/netrom/nr_in.c:298
nr_rx_frame+0x38b/0x1f70 net/netrom/af_netrom.c:930
nr_loopback_timer+0x75/0x150 net/netrom/nr_loopback.c:62
call_timer_fn+0x161/0x670 kernel/time/timer.c:1279
expire_timers kernel/time/timer.c:1318 [inline]
__run_timers kernel/time/timer.c:1636 [inline]
__run_timers kernel/time/timer.c:1604 [inline]
run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649
__do_softirq+0x244/0x9a0 kernel/softirq.c:288

The buggy address belongs to the object at ffff888024d84b80
which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 8 bytes inside of
232-byte region [ffff888024d84b80, ffff888024d84c68)
The buggy address belongs to the page:
page:ffffea0000936100 count:1 mapcount:0 mapping:ffff888024d84040 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff888024d84040 0000000000000000 000000010000000c
raw: ffffea00026623e0 ffff8880a9eddb48 ffff88821b79a540 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888024d84a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888024d84b00: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
> ffff888024d84b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888024d84c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff888024d84c80: fc fc fc fc fc fc fc fc 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 2, 2020, 5:00:06 PM4/2/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages