syzbot


KASAN: slab-out-of-bounds Write in netif_napi_del

Status: upstream: reported C repro on 2022/06/18 00:43
Reported-by: syzbot+4cf3e704160dcf55065f@syzkaller.appspotmail.com
First crash: 169d, last: 104d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 general protection fault in netif_napi_del (2) C error 22 90d 173d 0/1 upstream: reported C repro on 2022/06/13 16:31
linux-4.19 general protection fault in netif_napi_del 1 686d 686d 0/1 auto-closed as invalid on 2021/05/17 13:27

Sample crash report:
netlink: 20 bytes leftover after parsing attributes in process `syz-executor429'.
==================================================================
BUG: KASAN: slab-out-of-bounds in test_and_clear_bit include/asm-generic/bitops-instrumented.h:185 [inline]
BUG: KASAN: slab-out-of-bounds in napi_hash_del net/core/dev.c:6228 [inline]
BUG: KASAN: slab-out-of-bounds in netif_napi_del+0x2c/0x7a0 net/core/dev.c:6323
Write of size 8 at addr ffff8881dd037f10 by task syz-executor429/306

CPU: 0 PID: 306 Comm: syz-executor429 Not tainted 5.4.190-syzkaller-00060-g148e4ba7f4fc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18e/0x1d5 lib/dump_stack.c:118
 print_address_description+0x8c/0x630 mm/kasan/report.c:384
 __kasan_report+0xf6/0x130 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 check_memory_region_inline mm/kasan/generic.c:141 [inline]
 check_memory_region+0x298/0x2d0 mm/kasan/generic.c:191
 test_and_clear_bit include/asm-generic/bitops-instrumented.h:185 [inline]
 napi_hash_del net/core/dev.c:6228 [inline]
 netif_napi_del+0x2c/0x7a0 net/core/dev.c:6323
 free_netdev+0x188/0x310 net/core/dev.c:9697
 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263
 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2500
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933
 sock_sendmsg_nosec net/socket.c:638 [inline]
 sock_sendmsg net/socket.c:658 [inline]
 ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287
 ___sys_sendmsg net/socket.c:2341 [inline]
 __sys_sendmsg+0x235/0x2f0 net/socket.c:2387
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f6ac0ccda69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6ac0c7f308 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f6ac0d55428 RCX: 00007f6ac0ccda69
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004
RBP: 00007f6ac0d55420 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6ac0d5542c
R13: 00007f6ac0d23064 R14: 74656e2f7665642f R15: 0000000000022000

Allocated by task 155:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x131/0x1e0 mm/kasan/common.c:529
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc_node mm/slub.c:2829 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 kmem_cache_alloc+0xd0/0x210 mm/slub.c:2842
 getname_flags+0xb8/0x4e0 fs/namei.c:141
 do_sys_open+0x2a3/0x700 fs/open.c:1107
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 155:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 kasan_set_free_info mm/kasan/common.c:345 [inline]
 __kasan_slab_free+0x178/0x240 mm/kasan/common.c:487
 slab_free_hook mm/slub.c:1455 [inline]
 slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494
 slab_free mm/slub.c:3080 [inline]
 kmem_cache_free+0xa9/0x1d0 mm/slub.c:3096
 do_sys_open+0x59a/0x700 fs/open.c:1122
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881dd036600
 which belongs to the cache names_cache of size 4096
The buggy address is located 2320 bytes to the right of
 4096-byte region [ffff8881dd036600, ffff8881dd037600)
The buggy address belongs to the page:
page:ffffea0007740c00 refcount:1 mapcount:0 mapping:ffff8881f5cfa280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5cfa280
raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x194/0x380 mm/page_alloc.c:2171
 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857
 alloc_slab_page+0x39/0x3e0 mm/slub.c:343
 allocate_slab mm/slub.c:1683 [inline]
 new_slab+0x97/0x450 mm/slub.c:1749
 new_slab_objects mm/slub.c:2506 [inline]
 ___slab_alloc+0x320/0x4b0 mm/slub.c:2667
 __slab_alloc+0x5a/0x90 mm/slub.c:2707
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 kmem_cache_alloc+0x100/0x210 mm/slub.c:2842
 getname_flags+0xb8/0x4e0 fs/namei.c:141
 do_sys_open+0x2a3/0x700 fs/open.c:1107
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881dd037e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881dd037e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881dd037f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                         ^
 ffff8881dd037f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881dd038000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 306 Comm: syz-executor429 Tainted: G    B             5.4.190-syzkaller-00060-g148e4ba7f4fc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
RIP: 0010:flush_gro_hash net/core/dev.c:6313 [inline]
RIP: 0010:netif_napi_del+0x28f/0x7a0 net/core/dev.c:6328
Code: 00 74 08 4c 89 ff e8 10 3f 32 fe 49 8b 2f 49 39 ef 75 10 e8 43 d2 05 fe eb 35 90 e8 3b d2 05 fe 48 89 dd 48 89 e8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 ef e8 e2 3e 32 fe 48 8b 5d 00 48 89 ef
RSP: 0018:ffff8881dd67f790 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 1ffff1103ba06fff RCX: ffffffff835a7b10
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8881dd037f38
RBP: 0000000000000000 R08: ffffffff835a78e3 R09: fffffbfff0d3170d
R10: fffffbfff0d3170d R11: 1ffffffff0d3170c R12: ffff8881dd037f00
R13: dffffc0000000000 R14: ffff8881dd037f00 R15: ffff8881dd037f38
FS:  00007f6ac0c7f700(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055c20c237b60 CR3: 00000001dd416000 CR4: 00000000003406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 free_netdev+0x188/0x310 net/core/dev.c:9697
 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263
 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2500
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933
 sock_sendmsg_nosec net/socket.c:638 [inline]
 sock_sendmsg net/socket.c:658 [inline]
 ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287
 ___sys_sendmsg net/socket.c:2341 [inline]
 __sys_sendmsg+0x235/0x2f0 net/socket.c:2387
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f6ac0ccda69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6ac0c7f308 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f6ac0d55428 RCX: 00007f6ac0ccda69
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004
RBP: 00007f6ac0d55420 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6ac0d5542c
R13: 00007f6ac0d23064 R14: 74656e2f7665642f R15: 0000000000022000
Modules linked in:
---[ end trace b8accaf6266896fd ]---
RIP: 0010:flush_gro_hash net/core/dev.c:6313 [inline]
RIP: 0010:netif_napi_del+0x28f/0x7a0 net/core/dev.c:6328
Code: 00 74 08 4c 89 ff e8 10 3f 32 fe 49 8b 2f 49 39 ef 75 10 e8 43 d2 05 fe eb 35 90 e8 3b d2 05 fe 48 89 dd 48 89 e8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 ef e8 e2 3e 32 fe 48 8b 5d 00 48 89 ef
RSP: 0018:ffff8881dd67f790 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 1ffff1103ba06fff RCX: ffffffff835a7b10
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8881dd037f38
RBP: 0000000000000000 R08: ffffffff835a78e3 R09: fffffbfff0d3170d
R10: fffffbfff0d3170d R11: 1ffffffff0d3170c R12: ffff8881dd037f00
R13: dffffc0000000000 R14: ffff8881dd037f00 R15: ffff8881dd037f38
FS:  00007f6ac0c7f700(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055c20c237b60 CR3: 00000001dd416000 CR4: 00000000003406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	00 74 08 4c          	add    %dh,0x4c(%rax,%rcx,1)
   4:	89 ff                	mov    %edi,%edi
   6:	e8 10 3f 32 fe       	callq  0xfe323f1b
   b:	49 8b 2f             	mov    (%r15),%rbp
   e:	49 39 ef             	cmp    %rbp,%r15
  11:	75 10                	jne    0x23
  13:	e8 43 d2 05 fe       	callq  0xfe05d25b
  18:	eb 35                	jmp    0x4f
  1a:	90                   	nop
  1b:	e8 3b d2 05 fe       	callq  0xfe05d25b
  20:	48 89 dd             	mov    %rbx,%rbp
  23:	48 89 e8             	mov    %rbp,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1) <-- trapping instruction
  2f:	74 08                	je     0x39
  31:	48 89 ef             	mov    %rbp,%rdi
  34:	e8 e2 3e 32 fe       	callq  0xfe323f1b
  39:	48 8b 5d 00          	mov    0x0(%rbp),%rbx
  3d:	48 89 ef             	mov    %rbp,%rdi

Crashes (11):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-android-5-4-kasan 2022/07/03 22:12 android12-5.4 148e4ba7f4fc 1434eec0 .config log report syz C KASAN: slab-out-of-bounds Write in netif_napi_del
ci2-android-5-4-kasan 2022/07/03 19:36 android12-5.4 148e4ba7f4fc 1434eec0 .config log report syz C KASAN: slab-out-of-bounds Write in netif_napi_del
ci2-android-5-4-kasan 2022/06/18 02:39 android12-5.4 77dc925ddffb 8f633d84 .config log report syz C KASAN: slab-out-of-bounds Write in netif_napi_del
ci2-android-5-4-kasan 2022/06/18 01:52 android12-5.4 77dc925ddffb 8f633d84 .config log report syz C KASAN: slab-out-of-bounds Write in netif_napi_del
ci2-android-5-4-kasan 2022/06/18 01:05 android12-5.4 77dc925ddffb 8f633d84 .config log report syz C KASAN: slab-out-of-bounds Write in netif_napi_del
ci2-android-5-4-kasan 2022/06/18 00:42 android12-5.4 77dc925ddffb 8f633d84 .config log report syz C KASAN: slab-out-of-bounds Write in netif_napi_del
ci2-android-5-4-kasan 2022/06/21 16:14 android12-5.4 77dc925ddffb 0fc5c330 .config log report syz C general protection fault in netif_napi_del
ci2-android-5-4-kasan 2022/07/20 21:23 android12-5.4 330fa791a029 88cb1383 .config log report info KASAN: slab-out-of-bounds Write in netif_napi_del
ci2-android-5-4-kasan 2022/08/22 01:01 android12-5.4 f3c75e616e3f 26a13b38 .config log report info KASAN: use-after-free Write in netif_napi_del
ci2-android-5-4-kasan 2022/06/21 23:01 android12-5.4 4cc9c9d71eec 0fc5c330 .config log report info general protection fault in netif_napi_del
ci2-android-5-4-kasan 2022/06/18 17:36 android12-5.4 77dc925ddffb 8f633d84 .config log report info general protection fault in netif_napi_del
* Struck through repros no longer work on HEAD.