syzbot


KASAN: use-after-free Write in rxrpc_put_bundle

Status: fixed on 2020/11/16 12:12
Subsystems: afs net
[Documentation on labels]
Reported-by: syzbot+d57aaf84dd8a550e6d91@syzkaller.appspotmail.com
Fix commit: f3af4ad1e08a rxrpc: Fix bundle counting for exclusive connections
First crash: 1551d, last: 1527d
Cause bisection: introduced by (bisect log) :
commit 245500d853e9f20036cec7df4f6984ece4c6bf26
Author: David Howells <dhowells@redhat.com>
Date: Wed Jul 1 10:15:32 2020 +0000

  rxrpc: Rewrite the client connection manager

Crash: kernel BUG at net/rxrpc/conn_object.c:LINE! (log)
Repro: C syz .config
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH net-next 0/2] rxrpc: Fixes 5 (5) 2020/10/15 18:33
[PATCH net-next 00/23] rxrpc: Fixes and preparation for RxGK 29 (29) 2020/10/03 21:32
KASAN: use-after-free Write in rxrpc_put_bundle 0 (1) 2020/09/16 08:52
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in rxrpc_put_bundle (2) afs net 1 1265d 1260d 0/28 auto-closed as invalid on 2021/10/26 20:57
upstream KASAN: use-after-free Write in rxrpc_put_bundle (3) afs net 2 1104d 1120d 0/28 closed as invalid on 2022/01/07 19:06
upstream KASAN: use-after-free Write in rxrpc_put_bundle (4) afs net 1 999d 999d 0/28 auto-closed as invalid on 2022/06/19 15:12
Last patch testing requests (2)
Created Duration User Patch Repo Result
2020/09/29 21:41 21m dhowells@redhat.com git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git f61e0184e845b7e48adafb0535b4e12771311a84 OK
2020/09/18 10:14 17m yepeilin.cs@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master OK

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_write include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in atomic_dec_return include/asm-generic/atomic-instrumented.h:340 [inline]
BUG: KASAN: use-after-free in rxrpc_put_bundle+0x1d/0x80 net/rxrpc/conn_client.c:141
Write of size 4 at addr ffff8880a8669220 by task ksoftirqd/0/9

CPU: 0 PID: 9 Comm: ksoftirqd/0 Not tainted 5.9.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x198/0x1fd lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 check_memory_region_inline mm/kasan/generic.c:186 [inline]
 check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
 instrument_atomic_write include/linux/instrumented.h:71 [inline]
 atomic_dec_return include/asm-generic/atomic-instrumented.h:340 [inline]
 rxrpc_put_bundle+0x1d/0x80 net/rxrpc/conn_client.c:141
 rxrpc_destroy_connection+0x150/0x2f0 net/rxrpc/conn_object.c:367
 rcu_do_batch kernel/rcu/tree.c:2428 [inline]
 rcu_core+0x5ca/0x1130 kernel/rcu/tree.c:2656
 __do_softirq+0x1f7/0xa91 kernel/softirq.c:298
 run_ksoftirqd kernel/softirq.c:652 [inline]
 run_ksoftirqd+0xcf/0x170 kernel/softirq.c:644
 smpboot_thread_fn+0x655/0x9e0 kernel/smpboot.c:165
 kthread+0x3b5/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Allocated by task 6875:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 kmem_cache_alloc_trace+0x174/0x2c0 mm/slab.c:3550
 kmalloc include/linux/slab.h:554 [inline]
 kzalloc include/linux/slab.h:666 [inline]
 rxrpc_alloc_bundle+0x7e/0x290 net/rxrpc/conn_client.c:121
 rxrpc_look_up_bundle net/rxrpc/conn_client.c:275 [inline]
 rxrpc_prep_call net/rxrpc/conn_client.c:374 [inline]
 rxrpc_connect_call+0x85c/0x1580 net/rxrpc/conn_client.c:710
 rxrpc_new_client_call+0x961/0x1020 net/rxrpc/call_object.c:331
 rxrpc_new_client_call_for_sendmsg net/rxrpc/sendmsg.c:622 [inline]
 rxrpc_do_sendmsg+0xf14/0x136d net/rxrpc/sendmsg.c:679
 rxrpc_sendmsg+0x420/0x630 net/rxrpc/af_rxrpc.c:560
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x331/0x810 net/socket.c:2353
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
 __sys_sendmmsg+0x195/0x480 net/socket.c:2497
 __do_sys_sendmmsg net/socket.c:2526 [inline]
 __se_sys_sendmmsg net/socket.c:2523 [inline]
 __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2523
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 2642:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422
 __cache_free mm/slab.c:3418 [inline]
 kfree+0x10e/0x2b0 mm/slab.c:3756
 rxrpc_put_bundle net/rxrpc/conn_client.c:146 [inline]
 rxrpc_put_bundle+0x6b/0x80 net/rxrpc/conn_client.c:138
 rxrpc_unbundle_conn+0x1f8/0x3d0 net/rxrpc/conn_client.c:935
 rxrpc_clean_up_local_conns+0x38d/0x587 net/rxrpc/conn_client.c:1114
 rxrpc_local_destroyer net/rxrpc/local_object.c:399 [inline]
 rxrpc_local_processor+0x38d/0x5e0 net/rxrpc/local_object.c:433
 process_one_work+0x94c/0x1670 kernel/workqueue.c:2269
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2415
 kthread+0x3b5/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

The buggy address belongs to the object at ffff8880a8669200
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 32 bytes inside of
 192-byte region [ffff8880a8669200, ffff8880a86692c0)
The buggy address belongs to the page:
page:000000007bfb6cde refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880a8669d00 pfn:0xa8669
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002a42f88 ffffea00027d8f08 ffff8880aa040000
raw: ffff8880a8669d00 ffff8880a8669000 000000010000000d 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a8669100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a8669180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a8669200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8880a8669280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a8669300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (229):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/09/15 11:31 net-next-old ed6d9b022813 6989d6f6 .config console log report syz C ci-upstream-net-kasan-gce
2020/10/09 12:03 net-next-old 9d49aea13f1e 92390980 .config console log report info ci-upstream-net-kasan-gce
2020/10/08 07:50 net-next-old 9faebeb2d800 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/07 23:08 net-next-old 9faebeb2d800 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/07 12:27 net-next-old 9faebeb2d800 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/07 11:08 net-next-old 9faebeb2d800 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/07 09:57 bpf-next 67ed375530e2 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/07 07:47 bpf-next 67ed375530e2 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/07 05:14 net-next-old 9faebeb2d800 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/07 01:23 net-next-old 8b0308fe319b 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/06 22:38 net-next-old 8b0308fe319b 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/06 21:19 net-next-old 8b0308fe319b 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/06 19:56 net-next-old 8b0308fe319b 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/06 19:35 net-next-old 8b0308fe319b 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/06 18:27 bpf-next dca4121cdc48 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/06 17:08 bpf-next dca4121cdc48 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/06 13:51 bpf-next dca4121cdc48 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/06 11:45 net-next-old c2568c8c9e63 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/06 10:42 bpf-next 8731745e4821 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/06 07:32 net-next-old c2568c8c9e63 1880b4a9 .config console log report info ci-upstream-net-kasan-gce
2020/10/06 06:00 bpf-next 8731745e4821 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/06 01:33 bpf-next 8731745e4821 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/05 21:55 bpf-next 8731745e4821 1880b4a9 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/05 12:22 net-next-old f5083d0cee08 5ef9c291 .config console log report info ci-upstream-net-kasan-gce
2020/10/05 11:54 net-next-old f5083d0cee08 5ef9c291 .config console log report info ci-upstream-net-kasan-gce
2020/10/05 10:31 net-next-old f5083d0cee08 5ef9c291 .config console log report info ci-upstream-net-kasan-gce
2020/10/05 06:21 net-next-old f5083d0cee08 5ef9c291 .config console log report info ci-upstream-net-kasan-gce
2020/10/05 02:13 net-next-old f5083d0cee08 5ef9c291 .config console log report info ci-upstream-net-kasan-gce
2020/10/04 09:25 bpf-next 1028ae406999 1a3f9408 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/03 20:46 net-next-old 678cdd496708 2653fa43 .config console log report info ci-upstream-net-kasan-gce
2020/10/03 19:07 net-next-old 678cdd496708 2653fa43 .config console log report info ci-upstream-net-kasan-gce
2020/10/03 16:32 bpf-next 1028ae406999 2653fa43 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/03 12:30 net-next-old 678cdd496708 2653fa43 .config console log report info ci-upstream-net-kasan-gce
2020/10/03 10:58 net-next-old 678cdd496708 2653fa43 .config console log report info ci-upstream-net-kasan-gce
2020/10/03 06:01 net-next-old 678cdd496708 2653fa43 .config console log report info ci-upstream-net-kasan-gce
2020/10/03 04:55 bpf-next 1028ae406999 2653fa43 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/03 02:21 bpf-next 360f89874635 4969d6ca .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/02 22:59 bpf-next 360f89874635 4969d6ca .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/02 20:03 net-next-old 360f89874635 4969d6ca .config console log report info ci-upstream-net-kasan-gce
2020/10/02 19:55 net-next-old 360f89874635 4969d6ca .config console log report info ci-upstream-net-kasan-gce
2020/10/02 18:54 net-next-old 360f89874635 4969d6ca .config console log report info ci-upstream-net-kasan-gce
2020/10/02 17:37 net-next-old 360f89874635 4969d6ca .config console log report info ci-upstream-net-kasan-gce
2020/10/02 15:37 bpf-next 360f89874635 4969d6ca .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/02 13:52 bpf-next 6208689fb3e6 9602ddf4 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/10/07 08:34 linux-next a804ab086e9d 1880b4a9 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/10/07 04:13 linux-next a804ab086e9d 1880b4a9 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/10/07 00:06 linux-next a804ab086e9d 1880b4a9 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/10/06 08:33 linux-next 2172e358cd17 1880b4a9 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/10/03 08:37 linux-next 2172e358cd17 2653fa43 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/10/02 11:28 linux-next d39294091fee 9602ddf4 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/15 09:38 linux-next 6b02addb1d17 6989d6f6 .config console log report info ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.