syzbot


KASAN: use-after-free Read in ___neigh_lookup_noref

Status: auto-closed as invalid on 2022/05/04 03:23
Subsystems: net
[Documentation on labels]
First crash: 806d, last: 806d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in neigh_key_eq128 include/net/neighbour.h:292 [inline]
BUG: KASAN: use-after-free in ___neigh_lookup_noref.constprop.0+0x69a/0x7d0 include/net/neighbour.h:313
Read of size 4 at addr ffff888016353b18 by task syz-executor.0/3849

CPU: 1 PID: 3849 Comm: syz-executor.0 Not tainted 5.17.0-rc2-syzkaller-00054-g27bb0b18c208 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x8d/0x303 mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 neigh_key_eq128 include/net/neighbour.h:292 [inline]
 ___neigh_lookup_noref.constprop.0+0x69a/0x7d0 include/net/neighbour.h:313
 __ipv6_neigh_lookup_noref include/net/ndisc.h:383 [inline]
 ip6_finish_output2+0x383/0x14f0 net/ipv6/ip6_output.c:121
 __ip6_finish_output net/ipv6/ip6_output.c:191 [inline]
 __ip6_finish_output+0x61e/0xe90 net/ipv6/ip6_output.c:170
 ip6_finish_output+0x32/0x200 net/ipv6/ip6_output.c:201
 NF_HOOK_COND include/linux/netfilter.h:296 [inline]
 ip6_output+0x1e4/0x530 net/ipv6/ip6_output.c:224
 dst_output include/net/dst.h:451 [inline]
 NF_HOOK include/linux/netfilter.h:307 [inline]
 ndisc_send_skb+0xa99/0x17f0 net/ipv6/ndisc.c:508
 ndisc_send_rs+0x12e/0x6f0 net/ipv6/ndisc.c:702
 addrconf_rs_timer+0x3f2/0x820 net/ipv6/addrconf.c:3911
 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
 expire_timers kernel/time/timer.c:1466 [inline]
 __run_timers.part.0+0x67c/0xa30 kernel/time/timer.c:1734
 __run_timers kernel/time/timer.c:1715 [inline]
 run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:fd_install+0xae/0x640 fs/file.c:580
Code: a4 ff 45 84 ed 58 0f 84 80 01 00 00 e8 1b f1 a4 ff 48 8d 7d 04 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 04 02 <48> 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 f0 03 00 00 44 0f b6 6d
RSP: 0018:ffffc90002b57d68 EFLAGS: 00000a03
RAX: 0000000000000000 RBX: 0000000000000004 RCX: ffffc900039e0000
RDX: 1ffff1100356f180 RSI: ffffffff81d2b315 RDI: ffff88801ab78c04
RBP: ffff88801ab78c00 R08: 0000000000000000 R09: 0000000000000001
R10: ffffffff81d2b306 R11: 0000000000000000 R12: ffff88806db50000
R13: 0000000000000001 R14: ffff888070199608 R15: ffff8880496411c8
 __do_sys_perf_event_open+0x1f29/0x3130 kernel/events/core.c:12517
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fa5e7bef059
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007fa5e6564168 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
RAX: ffffffffffffffda RBX: 00007fa5e7d01f60 RCX: 00007fa5e7bef059
RDX: ffffffffffffffff RSI: 0000000000000000 RDI: 0000000020002300
RBP: 00007fa5e7c4908d R08: 0000000000000000 R09: 0000000000000000
R10: ffffffffffffffff R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd974693ef R14: 00007fa5e6564300 R15: 0000000000022000
 </TASK>

Allocated by task 49:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 ____kasan_kmalloc mm/kasan/common.c:515 [inline]
 ____kasan_kmalloc mm/kasan/common.c:474 [inline]
 __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524
 kasan_kmalloc include/linux/kasan.h:270 [inline]
 __do_kmalloc mm/slab.c:3694 [inline]
 __kmalloc+0x209/0x4d0 mm/slab.c:3703
 kmalloc include/linux/slab.h:586 [inline]
 kzalloc include/linux/slab.h:715 [inline]
 neigh_alloc net/core/neighbour.c:433 [inline]
 ___neigh_create+0x1504/0x2990 net/core/neighbour.c:618
 ip6_finish_output2+0x1070/0x14f0 net/ipv6/ip6_output.c:123
 __ip6_finish_output net/ipv6/ip6_output.c:191 [inline]
 __ip6_finish_output+0x61e/0xe90 net/ipv6/ip6_output.c:170
 ip6_finish_output+0x32/0x200 net/ipv6/ip6_output.c:201
 NF_HOOK_COND include/linux/netfilter.h:296 [inline]
 ip6_output+0x1e4/0x530 net/ipv6/ip6_output.c:224
 dst_output include/net/dst.h:451 [inline]
 NF_HOOK include/linux/netfilter.h:307 [inline]
 ndisc_send_skb+0xa99/0x17f0 net/ipv6/ndisc.c:508
 ndisc_send_rs+0x12e/0x6f0 net/ipv6/ndisc.c:702
 addrconf_dad_completed+0x397/0xd60 net/ipv6/addrconf.c:4229
 addrconf_dad_work+0x79f/0x1340 net/ipv6/addrconf.c:4139
 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307
 worker_thread+0x657/0x1110 kernel/workqueue.c:2454
 kthread+0x2e9/0x3a0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 32:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track+0x21/0x30 mm/kasan/common.c:45
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free mm/kasan/common.c:328 [inline]
 __kasan_slab_free+0xee/0x130 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:236 [inline]
 __cache_free mm/slab.c:3437 [inline]
 kfree+0xf6/0x290 mm/slab.c:3794
 kvfree+0x42/0x50 mm/util.c:613
 kfree_rcu_work+0x5f8/0xa10 kernel/rcu/tree.c:3356
 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307
 worker_thread+0x657/0x1110 kernel/workqueue.c:2454
 kthread+0x2e9/0x3a0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 __kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348
 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3591
 neigh_destroy+0x42e/0x630 net/core/neighbour.c:888
 neigh_release include/net/neighbour.h:451 [inline]
 neigh_cleanup_and_release+0x1fd/0x340 net/core/neighbour.c:103
 neigh_periodic_work+0x60c/0x9c0 net/core/neighbour.c:970
 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307
 worker_thread+0x657/0x1110 kernel/workqueue.c:2454
 kthread+0x2e9/0x3a0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888016353800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 792 bytes inside of
 1024-byte region [ffff888016353800, ffff888016353c00)
The buggy address belongs to the page:
page:ffffea000058d4c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16353
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00006ef588 ffffea0000508e48 ffff888010c40700
raw: 0000000000000000 ffff888016353000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2c2220(__GFP_HIGH|__GFP_ATOMIC|__GFP_NOWARN|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_THISNODE), pid 1256, ts 175723321653, free_ts 173348752357
 prep_new_page mm/page_alloc.c:2434 [inline]
 get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4165
 __alloc_pages_slowpath.constprop.0+0x2eb/0x20d0 mm/page_alloc.c:4934
 __alloc_pages+0x412/0x500 mm/page_alloc.c:5402
 __alloc_pages_node include/linux/gfp.h:572 [inline]
 kmem_getpages mm/slab.c:1378 [inline]
 cache_grow_begin+0x75/0x350 mm/slab.c:2584
 cache_alloc_refill+0x27f/0x380 mm/slab.c:2957
 ____cache_alloc mm/slab.c:3040 [inline]
 ____cache_alloc mm/slab.c:3023 [inline]
 slab_alloc_node mm/slab.c:3241 [inline]
 kmem_cache_alloc_node_trace+0x49c/0x5b0 mm/slab.c:3609
 __do_kmalloc_node mm/slab.c:3631 [inline]
 __kmalloc_node_track_caller+0x38/0x60 mm/slab.c:3646
 kmalloc_reserve net/core/skbuff.c:354 [inline]
 __alloc_skb+0xde/0x340 net/core/skbuff.c:426
 alloc_skb include/linux/skbuff.h:1158 [inline]
 ndisc_alloc_skb+0x134/0x320 net/ipv6/ndisc.c:420
 ndisc_send_ns+0x177/0x840 net/ipv6/ndisc.c:626
 addrconf_dad_work+0xc3f/0x1340 net/ipv6/addrconf.c:4153
 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307
 worker_thread+0x657/0x1110 kernel/workqueue.c:2454
 kthread+0x2e9/0x3a0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1352 [inline]
 free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404
 free_unref_page_prepare mm/page_alloc.c:3325 [inline]
 free_unref_page+0x19/0x690 mm/page_alloc.c:3404
 slab_destroy mm/slab.c:1630 [inline]
 slabs_destroy+0x89/0xc0 mm/slab.c:1650
 cache_flusharray mm/slab.c:3410 [inline]
 ___cache_free+0x312/0x5c0 mm/slab.c:3472
 qlink_free mm/kasan/quarantine.c:157 [inline]
 qlist_free_all+0x50/0x1a0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:446
 kasan_slab_alloc include/linux/kasan.h:260 [inline]
 slab_post_alloc_hook mm/slab.h:732 [inline]
 slab_alloc mm/slab.c:3315 [inline]
 kmem_cache_alloc_trace+0x258/0x4a0 mm/slab.c:3565
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:715 [inline]
 kobject_uevent_env+0x235/0x1600 lib/kobject_uevent.c:524
 __kobject_del+0x169/0x200 lib/kobject.c:617
 kobject_cleanup lib/kobject.c:696 [inline]
 kobject_release lib/kobject.c:736 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x2b6/0x540 lib/kobject.c:753
 net_rx_queue_update_kobjects+0x3f3/0x510 net/core/net-sysfs.c:1115
 netif_set_real_num_rx_queues+0x161/0x200 net/core/dev.c:2887
 veth_init_queues drivers/net/veth.c:1618 [inline]
 veth_init_queues+0x14d/0x190 drivers/net/veth.c:1608
 veth_newlink+0x74b/0xa90 drivers/net/veth.c:1740
 __rtnl_newlink+0x106e/0x1750 net/core/rtnetlink.c:3479

Memory state around the buggy address:
 ffff888016353a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888016353a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888016353b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff888016353b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888016353c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
   0:	a4                   	movsb  %ds:(%rsi),%es:(%rdi)
   1:	ff 45 84             	incl   -0x7c(%rbp)
   4:	ed                   	in     (%dx),%eax
   5:	58                   	pop    %rax
   6:	0f 84 80 01 00 00    	je     0x18c
   c:	e8 1b f1 a4 ff       	callq  0xffa4f12c
  11:	48 8d 7d 04          	lea    0x4(%rbp),%rdi
  15:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  1c:	fc ff df
  1f:	48 89 fa             	mov    %rdi,%rdx
  22:	48 c1 ea 03          	shr    $0x3,%rdx
  26:	0f b6 04 02          	movzbl (%rdx,%rax,1),%eax
* 2a:	48 89 fa             	mov    %rdi,%rdx <-- trapping instruction
  2d:	83 e2 07             	and    $0x7,%edx
  30:	38 d0                	cmp    %dl,%al
  32:	7f 08                	jg     0x3c
  34:	84 c0                	test   %al,%al
  36:	0f 85 f0 03 00 00    	jne    0x42c
  3c:	44                   	rex.R
  3d:	0f                   	.byte 0xf
  3e:	b6 6d                	mov    $0x6d,%dh

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/02/03 03:23 upstream 27bb0b18c208 4ebb2798 .config console log report info ci-qemu-upstream KASAN: use-after-free Read in ___neigh_lookup_noref
* Struck through repros no longer work on HEAD.