KASAN: use-after-free Write in __alloc_skb

Status: closed as invalid on 2019/12/08 05:44
First crash: 1111d, last: 1105d
similar bugs (5):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Write in __alloc_skb C done 2 1051d 1119d 1/1 fixed on 2020/02/11 15:16
upstream KASAN: use-after-free Write in __alloc_skb (3) C done inconclusive 2 483d 851d 0/24 upstream: reported C repro on 2020/07/29 18:24
upstream KASAN: use-after-free Write in __alloc_skb (2) C done 7 1064d 1081d 16/24 fixed on 2020/02/18 14:31
linux-4.14 KASAN: use-after-free Write in __alloc_skb (2) C 1 32d 857d 0/1 upstream: reported C repro on 2020/07/24 01:04
linux-4.14 KASAN: use-after-free Write in __alloc_skb C done 1 1051d 1081d 1/1 fixed on 2020/02/14 21:56

Sample crash report:
BUG: KASAN: use-after-free in memset include/linux/string.h:363 [inline]
BUG: KASAN: use-after-free in __alloc_skb+0x37b/0x5e0 net/core/skbuff.c:238
Write of size 32 at addr ffff88815287e9c0 by task syz-executor.0/20697

CPU: 0 PID: 20697 Comm: syz-executor.0 Not tainted 5.4.0-rc8 #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:634
 check_memory_region_inline mm/kasan/generic.c:185 [inline]
 check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192
 memset+0x24/0x40 mm/kasan/common.c:105
 memset include/linux/string.h:363 [inline]
 __alloc_skb+0x37b/0x5e0 net/core/skbuff.c:238
 alloc_skb include/linux/skbuff.h:1049 [inline]
 alloc_skb_with_frags+0x93/0x590 net/core/skbuff.c:5662
 sock_alloc_send_pskb+0x7ad/0x920 net/core/sock.c:2244
 sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2261
 mld_newpack+0x1d7/0x7f0 net/ipv6/mcast.c:1609
 add_grhead.isra.0+0x299/0x370 net/ipv6/mcast.c:1713
 add_grec+0x7db/0x10b0 net/ipv6/mcast.c:1844
 mld_send_cr net/ipv6/mcast.c:1970 [inline]
 mld_ifc_timer_expire+0x3d4/0x8a0 net/ipv6/mcast.c:2477
 call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404
 expire_timers kernel/time/timer.c:1449 [inline]
 __run_timers kernel/time/timer.c:1773 [inline]
 __run_timers kernel/time/timer.c:1740 [inline]
 run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786
 __do_softirq+0x262/0x98c kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:373 [inline]
 irq_exit+0x19b/0x1e0 kernel/softirq.c:413
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830
RIP: 0010:__kasan_check_read+0x8/0x20 mm/kasan/common.c:92
Code: c5 9d ff ff 48 8b 73 58 89 c2 48 c7 c7 00 63 a9 88 f7 da e8 3e 4c ae ff e9 0e ef ff ff 90 90 90 90 90 55 89 f6 31 d2 48 89 e5 <48> 8b 4d 08 e8 cf 26 00 00 5d c3 0f 1f 00 66 2e 0f 1f 84 00 00 00
RSP: 0018:ffff888215b47718 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: ffff888063f3e280 RBX: 00007fbf3df79000 RCX: ffffffff819ef0c9
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffea00024d70c0
RBP: ffff888215b47718 R08: ffff888063f3e280 R09: ffffed100c7e7c51
R10: ffffed100c7e7c50 R11: ffff888063f3e287 R12: ffffea00024d70c0
R13: ffff8882197cbbc0 R14: ffffea00024d70c0 R15: dffffc0000000000
 test_bit include/asm-generic/bitops-instrumented.h:237 [inline]
 PageSwapBacked include/linux/page-flags.h:340 [inline]
 mm_counter_file include/linux/mm.h:1664 [inline]
 mm_counter include/linux/mm.h:1673 [inline]
 zap_pte_range mm/memory.c:1061 [inline]
 zap_pmd_range mm/memory.c:1166 [inline]
 zap_pud_range mm/memory.c:1195 [inline]
 zap_p4d_range mm/memory.c:1216 [inline]
 unmap_page_range+0xd0b/0x25f0 mm/memory.c:1237
 unmap_single_vma+0x19d/0x300 mm/memory.c:1282
 unmap_vmas+0x189/0x300 mm/memory.c:1314
 exit_mmap+0x2ba/0x530 mm/mmap.c:3161
 __mmput kernel/fork.c:1079 [inline]
 mmput+0x179/0x4d0 kernel/fork.c:1100
 exit_mm kernel/exit.c:485 [inline]
 do_exit+0x823/0x2e60 kernel/exit.c:804
 do_group_exit+0x135/0x360 kernel/exit.c:921
 get_signal+0x47c/0x2500 kernel/signal.c:2734
 do_signal+0x87/0x1700 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:159
 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
 do_syscall_64+0x65f/0x760 arch/x86/entry/common.c:300
RIP: 0033:0x45a639
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fbf3c413cf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000075bfd0 RCX: 000000000045a639
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000075bfd0
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000075bfd4
R13: 0000000000a6fb7f R14: 00007fbf3c4149c0 R15: 000000000075bfd4

The buggy address belongs to the page:
page:ffffea00054a1f80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
raw: 06fffc0000000000 ffffea00054a1f88 ffffea00054a1f88 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88815287e880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88815287e900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88815287e980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88815287ea00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88815287ea80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2019/11/19 00:33 upstream af42d3466bdc 1daed50a .config log report
ci-upstream-kasan-gce 2019/11/13 02:18 upstream 100d46bd72ec 048f2d49 .config log report
* Struck through repros no longer work on HEAD.