syzbot


KASAN: use-after-free Read in ip_skb_dst_mtu

Status: upstream: reported C repro on 2024/02/15 18:25
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+39ef7f13906d535d2ef1@syzkaller.appspotmail.com
First crash: 237d, last: 132d
Fix bisection: the issue occurs on the latest tested release (bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2024/02/25 upstream (ToT) ab0a97cffa0b C [report] KASAN: slab-use-after-free Read in ip_skb_dst_mtu
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in ip_skb_dst_mtu netfilter C error 5 186d 218d 25/28 fixed on 2024/05/22 23:56
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/10/05 14:37 16m retest repro linux-5.15.y report log
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2024/07/10 01:53 3h20m bisect fix linux-5.15.y OK (0) job log
2024/05/31 11:54 1h27m bisect fix linux-5.15.y OK (0) job log log
2024/04/27 03:01 2h45m bisect fix linux-5.15.y OK (0) job log log
2024/03/27 00:53 1h48m bisect fix linux-5.15.y OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in sk_fullsock include/net/sock.h:2746 [inline]
BUG: KASAN: use-after-free in ip_skb_dst_mtu+0x84a/0x9d0 include/net/ip.h:478
Read of size 1 at addr ffff88814ac5e012 by task sshd/3499

CPU: 1 PID: 3499 Comm: sshd Not tainted 5.15.149-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 sk_fullsock include/net/sock.h:2746 [inline]
 ip_skb_dst_mtu+0x84a/0x9d0 include/net/ip.h:478
 __ip_finish_output+0x133/0x4a0 net/ipv4/ip_output.c:299
 ipvlan_process_v4_outbound+0x3cb/0x6b0 drivers/net/ipvlan/ipvlan_core.c:443
 ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:541 [inline]
 ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:604 [inline]
 ipvlan_queue_xmit+0xa4c/0x1150 drivers/net/ipvlan/ipvlan_core.c:670
 ipvlan_start_xmit+0x46/0x180 drivers/net/ipvlan/ipvlan_main.c:222
 __netdev_start_xmit include/linux/netdevice.h:5019 [inline]
 netdev_start_xmit include/linux/netdevice.h:5033 [inline]
 xmit_one net/core/dev.c:3617 [inline]
 dev_hard_start_xmit+0x298/0x7a0 net/core/dev.c:3633
 sch_direct_xmit+0x2b2/0x5e0 net/sched/sch_generic.c:342
 qdisc_restart net/sched/sch_generic.c:407 [inline]
 __qdisc_run+0xae2/0x1e90 net/sched/sch_generic.c:415
 qdisc_run+0x10d/0x320 include/net/pkt_sched.h:132
 net_tx_action+0x73a/0x8e0 net/core/dev.c:5088
 __do_softirq+0x3b3/0x93a kernel/softirq.c:558
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x155/0x240 kernel/softirq.c:637
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:do_poll fs/select.c:964 [inline]
RIP: 0010:do_sys_poll+0xd60/0x11e0 fs/select.c:1014
Code: 00 00 48 89 da eb 0a e8 9e 16 a5 ff 48 8b 54 24 78 48 8d bc 24 20 01 00 00 48 89 54 24 78 48 8b 4c 24 70 e8 a2 e9 ff ff 89 c3 <c7> 44 24 20 00 00 00 00 31 ff 89 c6 e8 cf 19 a5 ff 45 31 ff 85 db
RSP: 0018:ffffc900030278a0 EFLAGS: 00000282
RAX: 00000000fffffffc RBX: 00000000fffffffc RCX: ffffffff81db09e1
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc900030279e0
RBP: ffffc90003027e10 R08: dffffc0000000000 R09: fffff52000604f3d
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 0000000225c17d03 R14: 0000006cf3fc5676 R15: 00000000000001d3
 __do_sys_ppoll fs/select.c:1120 [inline]
 __se_sys_ppoll+0x29c/0x330 fs/select.c:1100
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fd7520cfad5
Code: 85 d2 74 0d 0f 10 02 48 8d 54 24 20 0f 11 44 24 20 64 8b 04 25 18 00 00 00 85 c0 75 27 41 b8 08 00 00 00 b8 0f 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 75 48 8b 15 24 73 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffe93c814f0 EFLAGS: 00000246 ORIG_RAX: 000000000000010f
RAX: ffffffffffffffda RBX: 00000000000668a0 RCX: 00007fd7520cfad5
RDX: 00007ffe93c81510 RSI: 0000000000000004 RDI: 000055a16e34d7d0
RBP: 000055a16e34c3a0 R08: 0000000000000008 R09: 0000000000000000
R10: 00007ffe93c815f8 R11: 0000000000000246 R12: 000055a16d368aa4
R13: 0000000000000001 R14: 000055a16d3693e8 R15: 00007ffe93c81578
 </TASK>

Allocated by task 3567:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __kmalloc+0x168/0x300 mm/slub.c:4407
 kmalloc include/linux/slab.h:596 [inline]
 sk_prot_alloc+0xe0/0x200 net/core/sock.c:1852
 sk_alloc+0x35/0x310 net/core/sock.c:1905
 packet_create+0x100/0x7a0 net/packet/af_packet.c:3316
 __sock_create+0x460/0x8d0 net/socket.c:1486
 sock_create net/socket.c:1537 [inline]
 __sys_socket+0x132/0x370 net/socket.c:1579
 __do_sys_socket net/socket.c:1588 [inline]
 __se_sys_socket net/socket.c:1586 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1586
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 3499:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xf1/0x270 mm/slub.c:4559
 sk_prot_free net/core/sock.c:1888 [inline]
 __sk_destruct+0x58e/0x840 net/core/sock.c:1974
 skb_orphan include/linux/skbuff.h:2896 [inline]
 ip_defrag+0x203/0x2590 net/ipv4/ip_fragment.c:482
 nf_ct_ipv4_gather_frags net/ipv4/netfilter/nf_defrag_ipv4.c:31 [inline]
 ipv4_conntrack_defrag+0x3b1/0x580 net/ipv4/netfilter/nf_defrag_ipv4.c:86
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:584
 nf_hook+0x2a6/0x430 include/linux/netfilter.h:257
 __ip_local_out+0x3b2/0x4f0 net/ipv4/ip_output.c:115
 ip_local_out+0x26/0x120 net/ipv4/ip_output.c:124
 ipvlan_process_v4_outbound+0x3cb/0x6b0 drivers/net/ipvlan/ipvlan_core.c:443
 ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:541 [inline]
 ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:604 [inline]
 ipvlan_queue_xmit+0xa4c/0x1150 drivers/net/ipvlan/ipvlan_core.c:670
 ipvlan_start_xmit+0x46/0x180 drivers/net/ipvlan/ipvlan_main.c:222
 __netdev_start_xmit include/linux/netdevice.h:5019 [inline]
 netdev_start_xmit include/linux/netdevice.h:5033 [inline]
 xmit_one net/core/dev.c:3617 [inline]
 dev_hard_start_xmit+0x298/0x7a0 net/core/dev.c:3633
 sch_direct_xmit+0x2b2/0x5e0 net/sched/sch_generic.c:342
 qdisc_restart net/sched/sch_generic.c:407 [inline]
 __qdisc_run+0xae2/0x1e90 net/sched/sch_generic.c:415
 qdisc_run+0x10d/0x320 include/net/pkt_sched.h:132
 net_tx_action+0x73a/0x8e0 net/core/dev.c:5088
 __do_softirq+0x3b3/0x93a kernel/softirq.c:558

The buggy address belongs to the object at ffff88814ac5e000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 18 bytes inside of
 4096-byte region [ffff88814ac5e000, ffff88814ac5f000)
The buggy address belongs to the page:
page:ffffea00052b1600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14ac58
head:ffffea00052b1600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000010200 dead000000000100 dead000000000122 ffff888011c42140
raw: 0000000000000000 0000000000040004 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), pid 1, ts 8807362240, free_ts 0
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 kobject_uevent_env+0x283/0x8d0 lib/kobject_uevent.c:524
 rx_queue_add_kobject net/core/net-sysfs.c:1070 [inline]
 net_rx_queue_update_kobjects+0x215/0x470 net/core/net-sysfs.c:1110
 register_queue_kobjects net/core/net-sysfs.c:1767 [inline]
 netdev_register_kobject+0x222/0x310 net/core/net-sysfs.c:2018
 register_netdevice+0x108c/0x1720 net/core/dev.c:10354
 register_netdev+0x37/0x50 net/core/dev.c:10478
 nr_proto_init+0x16f/0x822 net/netrom/af_netrom.c:1424
 do_one_initcall+0x22b/0x7a0 init/main.c:1299
 do_initcall_level+0x157/0x207 init/main.c:1372
 do_initcalls+0x49/0x86 init/main.c:1388
 kernel_init_freeable+0x425/0x5b5 init/main.c:1612
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88814ac5df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88814ac5df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88814ac5e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88814ac5e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88814ac5e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	48 89 da             	mov    %rbx,%rdx
   5:	eb 0a                	jmp    0x11
   7:	e8 9e 16 a5 ff       	call   0xffa516aa
   c:	48 8b 54 24 78       	mov    0x78(%rsp),%rdx
  11:	48 8d bc 24 20 01 00 	lea    0x120(%rsp),%rdi
  18:	00
  19:	48 89 54 24 78       	mov    %rdx,0x78(%rsp)
  1e:	48 8b 4c 24 70       	mov    0x70(%rsp),%rcx
  23:	e8 a2 e9 ff ff       	call   0xffffe9ca
  28:	89 c3                	mov    %eax,%ebx
* 2a:	c7 44 24 20 00 00 00 	movl   $0x0,0x20(%rsp) <-- trapping instruction
  31:	00
  32:	31 ff                	xor    %edi,%edi
  34:	89 c6                	mov    %eax,%esi
  36:	e8 cf 19 a5 ff       	call   0xffa51a0a
  3b:	45 31 ff             	xor    %r15d,%r15d
  3e:	85 db                	test   %ebx,%ebx

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/02/25 11:45 linux-5.15.y 458ce51d0356 8d446f15 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ip_skb_dst_mtu
2024/02/15 18:24 linux-5.15.y 6139f2a02fe0 fd39cf6f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ip_skb_dst_mtu
* Struck through repros no longer work on HEAD.