syzbot


KASAN: use-after-free Read in rxrpc_see_skb

Status: fixed on 2020/10/21 11:01
Reported-by: syzbot+eabfc7851ff90a5237b3@syzkaller.appspotmail.com
Fix commit: 38eefb196438 MIPS: SNI: Fix MIPS_L1_CACHE_SHIFT
First crash: 889d, last: 889d

Fix bisection: fixed by (bisect log) :
commit 38eefb1964388f93644b35ec77000c5fbecca9cc
Author: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Date: Mon Sep 14 16:05:00 2020 +0000

  MIPS: SNI: Fix MIPS_L1_CACHE_SHIFT


Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in atomic_read arch/x86/include/asm/atomic.h:27 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:42 [inline]
BUG: KASAN: use-after-free in rxrpc_see_skb+0x29d/0x380 net/rxrpc/skbuff.c:41
Read of size 4 at addr ffff88808b8c13e4 by task kworker/0:1/24

CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 4.14.195-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: krxrpcd rxrpc_process_call
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
 __read_once_size include/linux/compiler.h:183 [inline]
 atomic_read arch/x86/include/asm/atomic.h:27 [inline]
 refcount_read include/linux/refcount.h:42 [inline]
 rxrpc_see_skb+0x29d/0x380 net/rxrpc/skbuff.c:41
 rxrpc_resend net/rxrpc/call_event.c:265 [inline]
 rxrpc_process_call+0x3b4/0x118f net/rxrpc/call_event.c:407
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 19487:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc_node+0x146/0x410 mm/slab.c:3642
 __alloc_skb+0x5c/0x510 net/core/skbuff.c:193
 alloc_skb include/linux/skbuff.h:980 [inline]
 alloc_skb_with_frags+0x85/0x500 net/core/skbuff.c:5228
 sock_alloc_send_pskb+0x577/0x6d0 net/core/sock.c:2083
 rxrpc_send_data+0x1455/0x2710 net/rxrpc/sendmsg.c:280
 rxrpc_do_sendmsg+0x9cc/0xfae net/rxrpc/sendmsg.c:639
 rxrpc_sendmsg+0x3cf/0x5f0 net/rxrpc/af_rxrpc.c:543
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:656
 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
 __sys_sendmsg+0xa3/0x120 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2103
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 19482:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 kfree_skbmem+0x98/0x100 net/core/skbuff.c:586
 __kfree_skb net/core/skbuff.c:646 [inline]
 kfree_skb+0xf4/0x390 net/core/skbuff.c:663
 rxrpc_free_skb+0xcc/0x350 net/rxrpc/skbuff.c:67
 rxrpc_release_call+0x4a2/0x990 net/rxrpc/call_object.c:523
 rxrpc_release_calls_on_socket+0x583/0xbb0 net/rxrpc/call_object.c:610
 rxrpc_release_sock net/rxrpc/af_rxrpc.c:851 [inline]
 rxrpc_release+0x244/0x4fb net/rxrpc/af_rxrpc.c:881
 __sock_release+0xcd/0x2b0 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1139
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff88808b8c1300
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 228 bytes inside of
 232-byte region [ffff88808b8c1300, ffff88808b8c13e8)
The buggy address belongs to the page:
page:ffffea00022e3040 count:1 mapcount:0 mapping:ffff88808b8c1080 index:0xffff88808b8c1a80
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88808b8c1080 ffff88808b8c1a80 0000000100000003
raw: ffffea000226b9a0 ffffea00026c3260 ffff8880a99bda80 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808b8c1280: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
 ffff88808b8c1300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808b8c1380: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
                                                       ^
 ffff88808b8c1400: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff88808b8c1480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-14 2020/09/01 05:41 linux-4.14.y d7e78d08fa77 d5a3ae1f .config console log report syz
* Struck through repros no longer work on HEAD.