KASAN: use-after-free Read in dev_queue_xmit_nit (2)

8 views
Skip to first unread message

syzbot

unread,
Jun 2, 2020, 4:57:18 AM6/2/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 4f68020f Linux 4.14.182
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11e59c0e100000
kernel config: https://syzkaller.appspot.com/x/.config?x=512ec6eb8f94d0c8
dashboard link: https://syzkaller.appspot.com/bug?extid=d27cdc6d1f87b2c65bf5
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+d27cdc...@syzkaller.appspotmail.com

IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
netlink: 28 bytes leftover after parsing attributes in process `syz-executor.1'.
overlayfs: filesystem on './file0' not supported as upperdir
==================================================================
netlink: 28 bytes leftover after parsing attributes in process `syz-executor.1'.
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in dev_queue_xmit_nit+0x7b5/0x950 net/core/dev.c:1929
Read of size 8 at addr ffff888092b01c68 by task syz-executor.2/20453

CPU: 0 PID: 20453 Comm: syz-executor.2 Not tainted 4.14.182-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+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/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+0xa9/0x2b9 mm/kasan/report.c:393
__read_once_size include/linux/compiler.h:183 [inline]
dev_queue_xmit_nit+0x7b5/0x950 net/core/dev.c:1929
xmit_one net/core/dev.c:3005 [inline]
dev_hard_start_xmit+0xa8/0x880 net/core/dev.c:3025
__dev_queue_xmit+0x1dce/0x25a0 net/core/dev.c:3525
neigh_hh_output include/net/neighbour.h:490 [inline]
neigh_output include/net/neighbour.h:498 [inline]
ip6_finish_output2+0xdab/0x21b0 net/ipv6/ip6_output.c:120
ip6_finish_output+0x702/0xaf0 net/ipv6/ip6_output.c:154
NF_HOOK_COND include/linux/netfilter.h:239 [inline]
ip6_output+0x1c5/0x660 net/ipv6/ip6_output.c:171
dst_output include/net/dst.h:462 [inline]
NF_HOOK include/linux/netfilter.h:250 [inline]
mld_sendpack+0x667/0xe90 net/ipv6/mcast.c:1660
mld_send_cr net/ipv6/mcast.c:1956 [inline]
mld_ifc_timer_expire+0x3b0/0x7b0 net/ipv6/mcast.c:2455
call_timer_fn+0x14a/0x650 kernel/time/timer.c:1279
expire_timers+0x233/0x4d0 kernel/time/timer.c:1318
__run_timers kernel/time/timer.c:1636 [inline]
run_timer_softirq+0x1d8/0x5b0 kernel/time/timer.c:1649
__do_softirq+0x254/0x9bf kernel/softirq.c:288
invoke_softirq kernel/softirq.c:368 [inline]
irq_exit+0x15b/0x1a0 kernel/softirq.c:409
exiting_irq arch/x86/include/asm/apic.h:648 [inline]
smp_apic_timer_interrupt+0x141/0x5f0 arch/x86/kernel/apic/apic.c:1102
apic_timer_interrupt+0x93/0xa0 arch/x86/entry/entry_64.S:793
</IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline]
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:192
RSP: 0018:ffff88821237f540 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff0f62c99 RBX: 0000000000000282 RCX: 1ffff11011ea0944
RDX: dffffc0000000000 RSI: ffff88808f504a28 RDI: 0000000000000282
RBP: ffffffff87b88120 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffea0000374620
R13: 0000000000000000 R14: 000000000000004c R15: ffffea00009521c0
__rcu_read_unlock+0x158/0x160 kernel/rcu/update.c:260
rcu_read_unlock include/linux/rcupdate.h:684 [inline]
__unlock_page_memcg+0x54/0x100 mm/memcontrol.c:1716
mark_buffer_dirty+0x30f/0x480 fs/buffer.c:1175
__block_write_begin_int+0x79c/0x1000 fs/buffer.c:2050
__block_write_begin fs/buffer.c:2088 [inline]
block_page_mkwrite+0x1d5/0x2b0 fs/buffer.c:2551
ext4_page_mkwrite+0xa6a/0xfd0 fs/ext4/inode.c:6158
do_page_mkwrite+0xd4/0x2e0 mm/memory.c:2383
wp_page_shared mm/memory.c:2675 [inline]
do_wp_page+0x830/0x1dc0 mm/memory.c:2775
handle_pte_fault mm/memory.c:4005 [inline]
__handle_mm_fault+0x1ee8/0x3700 mm/memory.c:4113
handle_mm_fault+0x306/0x794 mm/memory.c:4150
__do_page_fault+0x578/0xb50 arch/x86/mm/fault.c:1442
page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1123
RIP: 0010:copy_user_enhanced_fast_string+0xe/0x20 arch/x86/lib/copy_user_64.S:181
RSP: 0018:ffff88821237fb60 EFLAGS: 00010206
RAX: 0000000000000000 RBX: 0000000000001000 RCX: 0000000000000500
RDX: 0000000000001000 RSI: ffff888092775b00 RDI: 0000000020054000
RBP: 0000000020053500 R08: ffffed10124eec00 R09: 0000000000000000
R10: ffffed10124eebff R11: ffff888092775fff R12: ffff888092775000
R13: 00007ffffffff000 R14: 0000000020054500 R15: ffff88821237fde0
copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
raw_copy_to_user arch/x86/include/asm/uaccess_64.h:112 [inline]
copyout+0x99/0xc0 lib/iov_iter.c:137
copy_page_to_iter_iovec lib/iov_iter.c:206 [inline]
copy_page_to_iter+0x32a/0xc90 lib/iov_iter.c:723
pipe_to_user+0xa8/0x160 fs/splice.c:1237
splice_from_pipe_feed fs/splice.c:502 [inline]
__splice_from_pipe+0x332/0x740 fs/splice.c:626
vmsplice_to_user+0x197/0x1c0 fs/splice.c:1272
SYSC_vmsplice fs/splice.c:1353 [inline]
SyS_vmsplice+0x12a/0x150 fs/splice.c:1334
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45ca69
RSP: 002b:00007f6dbc3ddc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000116
RAX: ffffffffffffffda RBX: 000000000050a3c0 RCX: 000000000045ca69
RDX: 0000000000000001 RSI: 0000000020000000 RDI: 0000000000000005
RBP: 000000000078bfa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000c55 R14: 00000000004cea35 R15: 00007f6dbc3de6d4

Allocated by task 20463:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15a/0x400 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
sk_prot_alloc+0x1ba/0x290 net/core/sock.c:1467
sk_alloc+0x36/0xd30 net/core/sock.c:1521
packet_create+0xf5/0x7e0 net/packet/af_packet.c:3283
__sock_create+0x2f2/0x620 net/socket.c:1275
sock_create net/socket.c:1315 [inline]
SYSC_socket net/socket.c:1345 [inline]
SyS_socket+0xd1/0x1b0 net/socket.c:1325
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 20452:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xaf/0x190 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
sk_prot_free net/core/sock.c:1504 [inline]
__sk_destruct+0x4f5/0x640 net/core/sock.c:1581
sk_destruct+0x97/0xc0 net/core/sock.c:1596
__sk_free+0x4c/0x220 net/core/sock.c:1604
sk_free+0x2b/0x40 net/core/sock.c:1615
sock_put include/net/sock.h:1658 [inline]
packet_release+0x8c4/0xb70 net/packet/af_packet.c:3112
__sock_release+0xcd/0x2b0 net/socket.c:602
sock_close+0x15/0x20 net/socket.c:1139
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x113/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff888092b01480
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 2024 bytes inside of
2048-byte region [ffff888092b01480, ffff888092b01c80)
The buggy address belongs to the page:
page:ffffea00024ac000 count:1 mapcount:0 mapping:ffff888092b00380 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff888092b00380 0000000000000000 0000000100000003
raw: ffffea0002204b20 ffffea00011d5620 ffff8880aa800c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888092b01b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888092b01b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888092b01c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888092b01c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888092b01d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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,
Nov 17, 2020, 8:44:18 PM11/17/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 27ce4f2a Linux 4.14.206
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16dccec2500000
kernel config: https://syzkaller.appspot.com/x/.config?x=32258a0e1fac372d
dashboard link: https://syzkaller.appspot.com/bug?extid=d27cdc6d1f87b2c65bf5
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=117ce36e500000

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

wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in dev_queue_xmit_nit+0x7b5/0x950 net/core/dev.c:1925
Read of size 8 at addr ffff8880b4ef0968 by task syz-executor.0/12899

CPU: 0 PID: 12899 Comm: syz-executor.0 Not tainted 4.14.206-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+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
__read_once_size include/linux/compiler.h:183 [inline]
dev_queue_xmit_nit+0x7b5/0x950 net/core/dev.c:1925
xmit_one net/core/dev.c:3001 [inline]
dev_hard_start_xmit+0xaa/0x890 net/core/dev.c:3021
__dev_queue_xmit+0x1d7f/0x2480 net/core/dev.c:3521
neigh_hh_output include/net/neighbour.h:490 [inline]
neigh_output include/net/neighbour.h:498 [inline]
ip6_finish_output2+0xc6a/0x1f10 net/ipv6/ip6_output.c:120
ip6_finish_output+0x60c/0xaf0 net/ipv6/ip6_output.c:154
NF_HOOK_COND include/linux/netfilter.h:239 [inline]
ip6_output+0x1c5/0x660 net/ipv6/ip6_output.c:171
dst_output include/net/dst.h:470 [inline]
NF_HOOK include/linux/netfilter.h:250 [inline]
ndisc_send_skb+0x82a/0x1390 net/ipv6/ndisc.c:483
ndisc_send_rs+0x125/0x630 net/ipv6/ndisc.c:677
addrconf_rs_timer+0x2bb/0x5a0 net/ipv6/addrconf.c:3765
call_timer_fn+0x14a/0x650 kernel/time/timer.c:1280
expire_timers+0x232/0x4d0 kernel/time/timer.c:1319
__run_timers kernel/time/timer.c:1644 [inline]
run_timer_softirq+0x1d5/0x5a0 kernel/time/timer.c:1657
__do_softirq+0x254/0xa1d kernel/softirq.c:288
invoke_softirq kernel/softirq.c:368 [inline]
irq_exit+0x193/0x240 kernel/softirq.c:409
exiting_irq arch/x86/include/asm/apic.h:648 [inline]
smp_apic_timer_interrupt+0x141/0x5e0 arch/x86/kernel/apic/apic.c:1102
apic_timer_interrupt+0x93/0xa0 arch/x86/entry/entry_64.S:793
</IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline]
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:192
RSP: 0018:ffff88808dbbfaf8 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff11e1231 RBX: 0000000000000282 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: ffff888097880908 RDI: 0000000000000282
RBP: ffffffff8c069a48 R08: ffffffff8b9b3130 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff888097158000
R13: 0000000000000000 R14: ffffffff8c069a48 R15: 0000000000000000
__debug_check_no_obj_freed lib/debugobjects.c:760 [inline]
debug_check_no_obj_freed+0x2c0/0x674 lib/debugobjects.c:776
free_pages_prepare mm/page_alloc.c:1064 [inline]
__free_pages_ok+0x215/0xeb0 mm/page_alloc.c:1262
free_thread_stack kernel/fork.c:262 [inline]
release_task_stack kernel/fork.c:347 [inline]
put_task_stack+0xa0/0x1c0 kernel/fork.c:358
finish_task_switch+0x42c/0x610 kernel/sched/core.c:2692
context_switch kernel/sched/core.c:2811 [inline]
__schedule+0x893/0x1de0 kernel/sched/core.c:3384
preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:3508
___preempt_schedule+0x16/0x18
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
_raw_spin_unlock_irqrestore+0xaf/0xe0 kernel/locking/spinlock.c:192
__rcu_read_unlock+0x158/0x160 kernel/rcu/update.c:260
rcu_read_unlock include/linux/rcupdate.h:684 [inline]
__sock_create+0x2af/0x620 net/socket.c:1273
sock_create net/socket.c:1315 [inline]
SYSC_socket net/socket.c:1345 [inline]
SyS_socket+0xd1/0x1b0 net/socket.c:1325
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45deb9
RSP: 002b:00007fc949498c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000029
RAX: ffffffffffffffda RBX: 0000000000034cc0 RCX: 000000000045deb9
RDX: 0000000000000300 RSI: 0000000000000003 RDI: 0000000000000011
RBP: 000000000118bf60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118bf2c
R13: 00007ffed854dd0f R14: 00007fc9494999c0 R15: 000000000118bf2c

Allocated by task 12903:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15a/0x400 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
sk_prot_alloc+0x1ba/0x290 net/core/sock.c:1467
sk_alloc+0x36/0xcd0 net/core/sock.c:1521
packet_create+0xf5/0x7f0 net/packet/af_packet.c:3295
__sock_create+0x303/0x620 net/socket.c:1275
sock_create net/socket.c:1315 [inline]
SYSC_socket net/socket.c:1345 [inline]
SyS_socket+0xd1/0x1b0 net/socket.c:1325
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 12898:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
sk_prot_free net/core/sock.c:1504 [inline]
__sk_destruct+0x5e3/0x760 net/core/sock.c:1582
sk_destruct net/core/sock.c:1597 [inline]
__sk_free+0xd9/0x2d0 net/core/sock.c:1605
sk_free+0x2b/0x40 net/core/sock.c:1616
sock_put include/net/sock.h:1662 [inline]
packet_release+0x837/0xa80 net/packet/af_packet.c:3124
__sock_release+0xcd/0x2b0 net/socket.c:602
sock_close+0x15/0x20 net/socket.c:1139
__fput+0x25f/0x7a0 fs/file_table.c:210
task_work_run+0x11f/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880b4ef0180
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 2024 bytes inside of
2048-byte region [ffff8880b4ef0180, ffff8880b4ef0980)
The buggy address belongs to the page:
page:ffffea0002d3bc00 count:1 mapcount:0 mapping:ffff8880b4ef0180 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff8880b4ef0180 0000000000000000 0000000100000003
raw: ffffea0002d46520 ffffea0002d34ea0 ffff88813fe82c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b4ef0800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880b4ef0880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880b4ef0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880b4ef0980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880b4ef0a00: 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