syzbot


KASAN: use-after-free Write in ipgre_header (2)

Status: closed as invalid on 2023/10/27 14:39
Subsystems: net
[Documentation on labels]
First crash: 277d, last: 277d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Write in ipgre_header C error 1 602d 632d 0/1 upstream: reported C repro on 2022/08/04 21:58
upstream KASAN: use-after-free Write in ipgre_header net 1 515d 515d 0/26 closed as invalid on 2023/02/17 17:35
android-54 BUG: unable to handle kernel paging request in ipgre_header C 1 20d 632d 0/2 upstream: reported C repro on 2022/08/04 21:53

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ipgre_header+0x3af/0x3c0 net/ipv4/ip_gre.c:856
Write of size 2 at addr ffff88816b700004 by task syz-executor.5/9697

CPU: 1 PID: 9697 Comm: syz-executor.5 Not tainted 6.5.0-rc3-syzkaller-00020-gaf2e19389c2c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 ipgre_header+0x3af/0x3c0 net/ipv4/ip_gre.c:856
 dev_hard_header include/linux/netdevice.h:3144 [inline]
 neigh_connected_output+0x3b8/0x5d0 net/core/neighbour.c:1576
 neigh_output include/net/neighbour.h:544 [inline]
 ip_finish_output2+0x70a/0x24b0 net/ipv4/ip_output.c:230
 __ip_finish_output net/ipv4/ip_output.c:308 [inline]
 __ip_finish_output+0x38b/0x640 net/ipv4/ip_output.c:290
 ip_finish_output+0x31/0x280 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:292 [inline]
 ip_mc_output+0x241/0x720 net/ipv4/ip_output.c:417
 dst_output include/net/dst.h:458 [inline]
 ip_local_out+0xaf/0x190 net/ipv4/ip_output.c:127
 iptunnel_xmit+0x61a/0xa30 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x1e09/0x3350 net/ipv4/ip_tunnel.c:831
 ipgre_xmit+0x63c/0x910 net/ipv4/ip_gre.c:662
 __netdev_start_xmit include/linux/netdevice.h:4910 [inline]
 netdev_start_xmit include/linux/netdevice.h:4924 [inline]
 xmit_one net/core/dev.c:3537 [inline]
 dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553
 __dev_queue_xmit+0xa55/0x3f20 net/core/dev.c:4203
 dev_queue_xmit include/linux/netdevice.h:3088 [inline]
 neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581
 neigh_output include/net/neighbour.h:544 [inline]
 ip_finish_output2+0x70a/0x24b0 net/ipv4/ip_output.c:230
 __ip_finish_output net/ipv4/ip_output.c:308 [inline]
 __ip_finish_output+0x38b/0x640 net/ipv4/ip_output.c:290
 ip_finish_output+0x31/0x280 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:292 [inline]
 ip_mc_output+0x241/0x720 net/ipv4/ip_output.c:417
 dst_output include/net/dst.h:458 [inline]
 ip_local_out+0xaf/0x190 net/ipv4/ip_output.c:127
 iptunnel_xmit+0x61a/0xa30 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x1e09/0x3350 net/ipv4/ip_tunnel.c:831
 ipgre_xmit+0x63c/0x910 net/ipv4/ip_gre.c:662
 __netdev_start_xmit include/linux/netdevice.h:4910 [inline]
 netdev_start_xmit include/linux/netdevice.h:4924 [inline]
 xmit_one net/core/dev.c:3537 [inline]
 dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553
 __dev_queue_xmit+0xa55/0x3f20 net/core/dev.c:4203
 dev_queue_xmit include/linux/netdevice.h:3088 [inline]
 neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581
 neigh_output include/net/neighbour.h:544 [inline]
 ip_finish_output2+0x70a/0x24b0 net/ipv4/ip_output.c:230
 __ip_finish_output net/ipv4/ip_output.c:308 [inline]
 __ip_finish_output+0x38b/0x640 net/ipv4/ip_output.c:290
 ip_finish_output+0x31/0x280 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:292 [inline]
 ip_mc_output+0x241/0x720 net/ipv4/ip_output.c:417
 dst_output include/net/dst.h:458 [inline]
 ip_local_out+0xaf/0x190 net/ipv4/ip_output.c:127
 iptunnel_xmit+0x61a/0xa30 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x1e09/0x3350 net/ipv4/ip_tunnel.c:831
 ipgre_xmit+0x63c/0x910 net/ipv4/ip_gre.c:662
 __netdev_start_xmit include/linux/netdevice.h:4910 [inline]
 netdev_start_xmit include/linux/netdevice.h:4924 [inline]
 xmit_one net/core/dev.c:3537 [inline]
 dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553
 __dev_queue_xmit+0xa55/0x3f20 net/core/dev.c:4203
 dev_queue_xmit include/linux/netdevice.h:3088 [inline]
 neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581
 neigh_output include/net/neighbour.h:544 [inline]
 ip_finish_output2+0x70a/0x24b0 net/ipv4/ip_output.c:230
 __ip_finish_output net/ipv4/ip_output.c:308 [inline]
 __ip_finish_output+0x38b/0x640 net/ipv4/ip_output.c:290
 ip_finish_output+0x31/0x280 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:292 [inline]
 ip_mc_output+0x241/0x720 net/ipv4/ip_output.c:417
 dst_output include/net/dst.h:458 [inline]
 ip_local_out+0xaf/0x190 net/ipv4/ip_output.c:127
 iptunnel_xmit+0x61a/0xa30 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x1e09/0x3350 net/ipv4/ip_tunnel.c:831
 ipgre_xmit+0x63c/0x910 net/ipv4/ip_gre.c:662
 __netdev_start_xmit include/linux/netdevice.h:4910 [inline]
 netdev_start_xmit include/linux/netdevice.h:4924 [inline]
 xmit_one net/core/dev.c:3537 [inline]
 dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553
 __dev_queue_xmit+0xa55/0x3f20 net/core/dev.c:4203
 dev_queue_xmit include/linux/netdevice.h:3088 [inline]
 neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581
 neigh_output include/net/neighbour.h:544 [inline]
 ip_finish_output2+0x70a/0x24b0 net/ipv4/ip_output.c:230
 __ip_finish_output net/ipv4/ip_output.c:308 [inline]
 __ip_finish_output+0x38b/0x640 net/ipv4/ip_output.c:290
 ip_finish_output+0x31/0x280 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:292 [inline]
 ip_mc_output+0x241/0x720 net/ipv4/ip_output.c:417
 dst_output include/net/dst.h:458 [inline]
 ip_local_out+0xaf/0x190 net/ipv4/ip_output.c:127
 iptunnel_xmit+0x61a/0xa30 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x1e09/0x3350 net/ipv4/ip_tunnel.c:831
 ipgre_xmit+0x63c/0x910 net/ipv4/ip_gre.c:662
 __netdev_start_xmit include/linux/netdevice.h:4910 [inline]
 netdev_start_xmit include/linux/netdevice.h:4924 [inline]
 xmit_one net/core/dev.c:3537 [inline]
 dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553
 __dev_queue_xmit+0xa55/0x3f20 net/core/dev.c:4203
 dev_queue_xmit include/linux/netdevice.h:3088 [inline]
 neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581
 neigh_output include/net/neighbour.h:544 [inline]
 ip_finish_output2+0x70a/0x24b0 net/ipv4/ip_output.c:230
 __ip_finish_output net/ipv4/ip_output.c:308 [inline]
 __ip_finish_output+0x38b/0x640 net/ipv4/ip_output.c:290
 ip_finish_output+0x31/0x280 net/ipv4/ip_output.c:318
 NF_HOOK_COND include/linux/netfilter.h:292 [inline]
 ip_mc_output+0x241/0x720 net/ipv4/ip_output.c:417
 dst_output include/net/dst.h:458 [inline]
 ip_local_out net/ipv4/ip_output.c:127 [inline]
 ip_send_skb+0xd3/0x250 net/ipv4/ip_output.c:1477
 udp_send_skb+0x731/0x1470 net/ipv4/udp.c:979
 udp_sendmsg+0x1de3/0x2a50 net/ipv4/udp.c:1261
 inet_sendmsg+0x9d/0xe0 net/ipv4/af_inet.c:830
 sock_sendmsg_nosec net/socket.c:725 [inline]
 sock_sendmsg+0xd9/0x180 net/socket.c:748
 ____sys_sendmsg+0x2ac/0x940 net/socket.c:2494
 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2548
 __sys_sendmmsg+0x2a5/0x450 net/socket.c:2627
 __compat_sys_sendmmsg net/compat.c:360 [inline]
 __do_compat_sys_sendmmsg net/compat.c:367 [inline]
 __se_compat_sys_sendmmsg net/compat.c:364 [inline]
 __ia32_compat_sys_sendmmsg+0x9d/0x100 net/compat.c:364
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82
RIP: 0023:0xf7f8e579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f7f895ac EFLAGS: 00000292 ORIG_RAX: 0000000000000159
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020007fc0
RDX: 000000000800001d RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0005adc000 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16b700
flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 057ff00000000000 ffffea0005adc008 ffffea0005adc008 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffff88816b6fff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88816b6fff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88816b700000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88816b700080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88816b700100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	10 06                	adc    %al,(%rsi)
   2:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
   6:	10 07                	adc    %al,(%rdi)
   8:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
   c:	10 08                	adc    %cl,(%rax)
   e:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1e:	00 51 52             	add    %dl,0x52(%rcx)
  21:	55                   	push   %rbp
  22:	89 e5                	mov    %esp,%ebp
  24:	0f 34                	sysenter
  26:	cd 80                	int    $0x80
* 28:	5d                   	pop    %rbp <-- trapping instruction
  29:	5a                   	pop    %rdx
  2a:	59                   	pop    %rcx
  2b:	c3                   	ret
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  37:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/07/25 20:18 upstream af2e19389c2c 6756545c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 KASAN: use-after-free Write in ipgre_header
* Struck through repros no longer work on HEAD.