syzbot


KASAN: stack-out-of-bounds Read in skb_splice_from_iter

Status: fixed on 2023/09/28 17:51
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+d8486855ef44506fd675@syzkaller.appspotmail.com
Fix commit: 5a6f6873606e ip, ip6: Fix splice to raw and ping sockets
First crash: 322d, last: 311d
Cause bisection: introduced by (bisect log) :
commit 2dc334f1a63a8839b88483a3e73c0f27c9c1791c
Author: David Howells <dhowells@redhat.com>
Date: Wed Jun 7 18:19:09 2023 +0000

  splice, net: Use sendmsg(MSG_SPLICE_PAGES) rather than ->sendpage()

Crash: KASAN: stack-out-of-bounds Read in skb_splice_from_iter (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH net-next] ip, ip6: Fix splice to raw and ping sockets 5 (5) 2023/06/16 19:00
[syzbot] [net?] KASAN: stack-out-of-bounds Read in skb_splice_from_iter 3 (5) 2023/06/14 00:20
Last patch testing requests (1)
Created Duration User Patch Repo Result
2023/06/13 23:59 19m dhowells@redhat.com patch git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git main OK log

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in skb_splice_from_iter+0xcd6/0xd70 net/core/skbuff.c:6933
Read of size 8 at addr ffffc900039bf8f8 by task syz-executor193/5001

CPU: 1 PID: 5001 Comm: syz-executor193 Not tainted 6.4.0-rc5-syzkaller-00915-ge7c5433c5aaa #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
 print_report mm/kasan/report.c:462 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:572
 skb_splice_from_iter+0xcd6/0xd70 net/core/skbuff.c:6933
 __ip_append_data+0x1439/0x3c20 net/ipv4/ip_output.c:1210
 ip_append_data net/ipv4/ip_output.c:1350 [inline]
 ip_append_data+0x115/0x1a0 net/ipv4/ip_output.c:1329
 raw_sendmsg+0xb50/0x30a0 net/ipv4/raw.c:641
 inet_sendmsg+0x9d/0xe0 net/ipv4/af_inet.c:829
 sock_sendmsg_nosec net/socket.c:724 [inline]
 sock_sendmsg+0xde/0x190 net/socket.c:747
 splice_to_socket+0x954/0xe30 fs/splice.c:917
 do_splice_from fs/splice.c:969 [inline]
 do_splice+0xb8c/0x1e50 fs/splice.c:1309
 __do_splice+0x14e/0x270 fs/splice.c:1387
 __do_sys_splice fs/splice.c:1598 [inline]
 __se_sys_splice fs/splice.c:1580 [inline]
 __x64_sys_splice+0x19c/0x250 fs/splice.c:1580
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fba0bf36d29
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe0d4bac38 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fba0bf36d29
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007fba0befaed0 R08: 000000000004ffdd R09: 000000000000000d
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fba0befaf60
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

The buggy address belongs to stack of task syz-executor193/5001
 and is located at offset 408 in frame:
 raw_sendmsg+0x0/0x30a0 include/net/sock.h:2733

This frame has 8 objects:
 [48, 52) 'hdrincl'
 [64, 68) 'err'
 [80, 88) 'rt'
 [112, 152) 'ipc'
 [192, 240) 'state'
 [272, 336) 'fl4'
 [368, 392) 'rfv'
 [432, 504) 'opt_copy'

The buggy address belongs to the virtual mapping at
 [ffffc900039b8000, ffffc900039c1000) created by:
 kernel_clone+0xeb/0x890 kernel/fork.c:2915

The buggy address belongs to the physical page:
page:ffffea0001d6c880 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x75b22
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 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 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 4968, tgid 4968 (dhcpcd-run-hook), ts 47435778840, free_ts 47434086594
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
 vm_area_alloc_pages mm/vmalloc.c:3009 [inline]
 __vmalloc_area_node mm/vmalloc.c:3085 [inline]
 __vmalloc_node_range+0xb1c/0x14a0 mm/vmalloc.c:3257
 alloc_thread_stack_node kernel/fork.c:313 [inline]
 dup_task_struct kernel/fork.c:1116 [inline]
 copy_process+0x13bb/0x75c0 kernel/fork.c:2333
 kernel_clone+0xeb/0x890 kernel/fork.c:2915
 __do_sys_clone+0xba/0x100 kernel/fork.c:3058
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1302 [inline]
 free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2564
 free_unref_page_list+0xe3/0xa70 mm/page_alloc.c:2705
 release_pages+0xcd8/0x1380 mm/swap.c:1042
 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:97
 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline]
 tlb_flush_mmu mm/mmu_gather.c:299 [inline]
 tlb_finish_mmu+0x14b/0x7e0 mm/mmu_gather.c:391
 exit_mmap+0x2b2/0x930 mm/mmap.c:3123
 __mmput+0x128/0x4c0 kernel/fork.c:1351
 mmput+0x60/0x70 kernel/fork.c:1373
 exit_mm kernel/exit.c:567 [inline]
 do_exit+0x9b0/0x29b0 kernel/exit.c:861
 do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
 __do_sys_exit_group kernel/exit.c:1035 [inline]
 __se_sys_exit_group kernel/exit.c:1033 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1033
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffffc900039bf780: f1 f1 04 f2 00 00 00 f2 f2 f2 00 00 00 00 00 f2
 ffffc900039bf800: f2 f2 f2 f2 00 00 00 00 00 00 f2 f2 f2 f2 00 00
>ffffc900039bf880: 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 f2 f2 f2
                                                                ^
 ffffc900039bf900: f2 f2 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3 f3
 ffffc900039bf980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (64):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/09 20:18 net-next e7c5433c5aaa 7086cdb9 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/17 08:42 net-next c08afcdcf952 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/16 07:31 net-next 97c5209b3d37 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/16 06:15 net-next 97c5209b3d37 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/16 03:32 net-next 97c5209b3d37 757d26ed .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 21:24 net-next 97c5209b3d37 757d26ed .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 08:06 net-next fa0e21fa4443 76decb82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 05:01 net-next fa0e21fa4443 76decb82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 03:16 net-next fa0e21fa4443 76decb82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 12:44 net-next c29e012eae29 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 05:28 net-next 3a2cb45ca0cc 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/12 22:54 net-next 3a2cb45ca0cc 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/11 07:26 net-next e431e712c836 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/11 07:20 net-next e431e712c836 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/11 07:08 net-next e431e712c836 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/10 13:26 net-next ded5c1a16ec6 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/10 03:58 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 18:52 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 18:28 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 18:06 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 17:52 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 17:42 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 16:24 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 16:13 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/09 16:07 net-next e7c5433c5aaa 7086cdb9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/20 22:38 linux-next f7efed9f38f8 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/20 16:20 linux-next f7efed9f38f8 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/20 15:51 linux-next f7efed9f38f8 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/20 13:55 linux-next f7efed9f38f8 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/20 12:36 linux-next f7efed9f38f8 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/20 01:07 linux-next f7efed9f38f8 d521bc56 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/18 19:19 linux-next f7efed9f38f8 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/17 16:54 linux-next f7efed9f38f8 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 10:37 linux-next 925294c9aa18 76decb82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 10:37 linux-next 925294c9aa18 76decb82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 05:01 linux-next b16049b21162 76decb82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/15 03:27 linux-next b16049b21162 76decb82 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/14 00:21 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 23:55 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 22:10 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 21:43 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 21:03 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 17:30 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 17:01 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 17:01 linux-next 1f6ce8392d6f d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 16:01 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 15:07 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 13:31 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 13:05 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 10:51 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 10:47 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 10:21 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
2023/06/13 09:19 linux-next 1f6ce8392d6f 749afb64 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in skb_splice_from_iter
* Struck through repros no longer work on HEAD.