syzbot


KASAN: use-after-free Read in p9_poll_workfn

Status: fixed on 2018/08/28 17:48
Subsystems: v9fs
[Documentation on labels]
Reported-by: syzbot+39749ed7d9ef6dfb23f6@syzkaller.appspotmail.com
Fix commit: 430ac66eb4c5 net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree()
First crash: 2115d, last: 2076d
Discussions (9)
Title Replies (including bot) Last reply
[PATCH 3.16 000/328] 3.16.62-rc1 review 338 (338) 2018/12/16 22:01
[PATCH 4.18 000/145] 4.18.7-stable review 145 (145) 2018/09/10 15:56
[PATCH 4.14 00/89] 4.14.69-stable review 93 (93) 2018/09/10 15:42
[PATCH 4.9 00/63] 4.9.126-stable review 76 (76) 2018/09/10 15:03
[PATCH 4.4 00/47] 4.4.155-stable review 59 (59) 2018/09/10 15:01
[PATCH 3.18 00/29] 3.18.122-stable review 38 (38) 2018/09/10 15:00
[PATCH] [V9fs-developer] [PATCH] /net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree() 2 (2) 2018/07/23 02:39
[PATCH] /net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree() 2 (2) 2018/07/20 08:34
KASAN: use-after-free Read in p9_poll_workfn 0 (1) 2018/07/09 11:04
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: use-after-free Read in p9_poll_workfn C 14 2063d 1837d 0/3 public: reported C repro on 2019/04/13 00:00

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
8021q: adding VLAN 0 to HW filter on device team0
==================================================================
BUG: KASAN: use-after-free in p9_poll_mux net/9p/trans_fd.c:635 [inline]
BUG: KASAN: use-after-free in p9_poll_workfn+0x660/0x6d0 net/9p/trans_fd.c:1107
Read of size 4 at addr ffff8801d3c690c4 by task kworker/0:1/25

CPU: 0 PID: 25 Comm: kworker/0:1 Not tainted 4.18.0-rc6+ #160
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events p9_poll_workfn
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 p9_poll_mux net/9p/trans_fd.c:635 [inline]
 p9_poll_workfn+0x660/0x6d0 net/9p/trans_fd.c:1107
 process_one_work+0xc73/0x1ba0 kernel/workqueue.c:2153
 worker_thread+0x189/0x13c0 kernel/workqueue.c:2296
 kthread+0x345/0x410 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412

Allocated by task 4742:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620
 kmalloc include/linux/slab.h:513 [inline]
 kzalloc include/linux/slab.h:707 [inline]
 p9_fd_open net/9p/trans_fd.c:796 [inline]
 p9_fd_create+0x1a7/0x3f0 net/9p/trans_fd.c:1036
 p9_client_create+0x8ed/0x1770 net/9p/client.c:1063
 v9fs_session_init+0x21a/0x1a80 fs/9p/v9fs.c:400
 v9fs_mount+0x7c/0x900 fs/9p/vfs_super.c:135
 mount_fs+0xae/0x328 fs/super.c:1277
 vfs_kern_mount.part.34+0xdc/0x4e0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x581/0x30e0 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4742:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 p9_fd_close+0x416/0x5b0 net/9p/trans_fd.c:893
 p9_client_create+0xa9a/0x1770 net/9p/client.c:1077
 v9fs_session_init+0x21a/0x1a80 fs/9p/v9fs.c:400
 v9fs_mount+0x7c/0x900 fs/9p/vfs_super.c:135
 mount_fs+0xae/0x328 fs/super.c:1277
 vfs_kern_mount.part.34+0xdc/0x4e0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x581/0x30e0 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801d3c69040
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 132 bytes inside of
 512-byte region [ffff8801d3c69040, ffff8801d3c69240)
The buggy address belongs to the page:
page:ffffea00074f1a40 count:1 mapcount:0 mapping:ffff8801da800940 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00074f1a08 ffffea00074f1b08 ffff8801da800940
raw: 0000000000000000 ffff8801d3c69040 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d3c68f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801d3c69000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8801d3c69080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff8801d3c69100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d3c69180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (148):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/07/24 05:31 upstream d72e90f33aa4 912c93d7 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/24 01:12 upstream d72e90f33aa4 912c93d7 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 23:53 upstream d72e90f33aa4 912c93d7 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 23:28 upstream d72e90f33aa4 912c93d7 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 11:03 upstream d72e90f33aa4 f69c5fcd .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 09:55 upstream d72e90f33aa4 f69c5fcd .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 09:27 upstream d72e90f33aa4 f69c5fcd .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 09:03 upstream d72e90f33aa4 f69c5fcd .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 05:27 upstream d72e90f33aa4 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 04:50 upstream d72e90f33aa4 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/23 01:08 upstream 45ae4df92207 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/22 15:38 upstream 45ae4df92207 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/22 09:59 upstream 490fc053865c 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/22 09:40 upstream 490fc053865c 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/21 10:43 upstream 48e5aee81f32 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/21 08:12 upstream 48e5aee81f32 8cc079c3 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/21 06:34 upstream 28c20cc73b9c af255b09 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/20 22:54 upstream 28c20cc73b9c af255b09 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/20 20:46 upstream 28c20cc73b9c af255b09 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/20 20:16 upstream 28c20cc73b9c af255b09 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/20 17:54 upstream 28c20cc73b9c 49f35839 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/16 07:54 upstream 9d3cce1e8b85 92a49505 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/12 02:27 upstream c25c74b7476e 2e0e3130 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/11 15:41 upstream 1e09177acae3 2e0e3130 .config console log report syz C ci-upstream-kasan-gce
2018/07/10 21:46 upstream 30c2c32d7f70 2e0e3130 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/09 13:27 upstream 1e4b044d2251 f25e5770 .config console log report syz C ci-upstream-kasan-gce
2018/07/09 09:35 upstream ca04b3cca11a f25e5770 .config console log report syz C ci-upstream-kasan-gce
2018/07/09 08:05 upstream ca04b3cca11a f25e5770 .config console log report syz C ci-upstream-kasan-gce
2018/07/10 04:13 upstream 092150a25cb7 f25e5770 .config console log report syz C ci-upstream-kasan-gce-386
2018/07/09 21:07 upstream 1e4b044d2251 f25e5770 .config console log report syz C ci-upstream-kasan-gce-386
2018/07/14 14:09 linux-next 483d835c8189 92a49505 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/07/11 23:07 linux-next 98be45067040 2e0e3130 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/08/06 06:06 upstream a8c199208cd6 1beb8136 .config console log report syz ci-upstream-kasan-gce-root
2018/07/23 07:56 upstream d72e90f33aa4 8cc079c3 .config console log report syz ci-upstream-kasan-gce-root
2018/07/23 06:53 upstream d72e90f33aa4 8cc079c3 .config console log report syz ci-upstream-kasan-gce-root
2018/07/23 04:24 upstream d72e90f33aa4 8cc079c3 .config console log report syz ci-upstream-kasan-gce-root
2018/07/21 09:01 upstream 48e5aee81f32 8cc079c3 .config console log report syz ci-upstream-kasan-gce-root
2018/07/20 21:15 upstream 28c20cc73b9c af255b09 .config console log report syz ci-upstream-kasan-gce-root
2018/07/20 18:34 upstream 28c20cc73b9c 49f35839 .config console log report syz ci-upstream-kasan-gce-root
2018/07/11 01:02 upstream 30c2c32d7f70 2e0e3130 .config console log report syz ci-upstream-kasan-gce-386
2018/07/10 22:07 upstream 30c2c32d7f70 2e0e3130 .config console log report syz ci-upstream-kasan-gce-386
2018/07/10 00:09 upstream 1e4b044d2251 f25e5770 .config console log report syz ci-upstream-kasan-gce-386
2018/07/16 08:59 linux-next 1d4eb636f0ab 92a49505 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2018/08/17 14:17 upstream 5c60a7389d79 738da825 .config console log report ci-upstream-kasan-gce-root
2018/08/16 11:05 upstream dafa5f6577a9 9ccc1d45 .config console log report ci-upstream-kasan-gce-root
2018/08/16 00:12 upstream 31130a16d459 9ccc1d45 .config console log report ci-upstream-kasan-gce-root
2018/08/14 22:04 upstream 10f3e23f07cb 5084a625 .config console log report ci-upstream-kasan-gce-root
2018/08/13 21:28 upstream 94710cac0ef4 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/13 19:48 upstream 94710cac0ef4 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/12 23:28 upstream d6dd6431591b 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/12 20:43 upstream d6dd6431591b 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/12 17:17 upstream ec0c96714e7d 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/12 13:31 upstream ec0c96714e7d 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/12 11:23 upstream ec0c96714e7d 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/12 08:28 upstream ec0c96714e7d 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/12 01:07 upstream ec0c96714e7d 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/11 15:14 upstream f313b43be461 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/11 13:43 upstream f313b43be461 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/11 00:43 upstream f313b43be461 7a88b141 .config console log report ci-upstream-kasan-gce-root
2018/08/10 09:38 upstream 112cbae26d18 1fb62d58 .config console log report ci-upstream-kasan-gce-root
2018/08/10 06:25 upstream 112cbae26d18 1fb62d58 .config console log report ci-upstream-kasan-gce-root
2018/08/10 02:43 upstream 112cbae26d18 1fb62d58 .config console log report ci-upstream-kasan-gce-root
2018/08/09 17:43 upstream fedb8da96355 1fb62d58 .config console log report ci-upstream-kasan-gce-root
2018/08/08 09:33 upstream 1236568ee3cb ddeb9f8d .config console log report ci-upstream-kasan-gce-root
2018/08/08 04:25 upstream 1236568ee3cb 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/07 23:51 upstream 1236568ee3cb 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/07 09:53 upstream 1236568ee3cb 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/07 07:15 upstream 1236568ee3cb 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/07 03:19 upstream 1236568ee3cb 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/07 01:21 upstream 1ffaddd029c8 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/05 21:14 upstream a8c199208cd6 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/05 17:27 upstream a8c199208cd6 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/05 14:43 upstream 60f5a2173632 1beb8136 .config console log report ci-upstream-kasan-gce-root
2018/08/04 19:57 upstream 0b5b1f9a78b5 3476a2df .config console log report ci-upstream-kasan-gce-root
2018/08/04 18:00 upstream 0b5b1f9a78b5 3476a2df .config console log report ci-upstream-kasan-gce-root
2018/08/04 11:30 upstream 0b5b1f9a78b5 df7f6947 .config console log report ci-upstream-kasan-gce-root
2018/08/04 06:15 upstream 0b5b1f9a78b5 df7f6947 .config console log report ci-upstream-kasan-gce-root
2018/08/04 04:37 upstream 0b5b1f9a78b5 df7f6947 .config console log report ci-upstream-kasan-gce-root
2018/08/03 17:40 upstream 0585df468e8f cc4f6d0a .config console log report ci-upstream-kasan-gce-root
2018/08/02 07:50 upstream 6b4703768268 0a7cf4ec .config console log report ci-upstream-kasan-gce-root
2018/08/01 23:53 upstream 44960f2a7b63 0a7cf4ec .config console log report ci-upstream-kasan-gce-root
2018/08/01 18:41 upstream 44960f2a7b63 0a7cf4ec .config console log report ci-upstream-kasan-gce-root
2018/08/01 16:10 upstream c1d61e7fe376 1477993e .config console log report ci-upstream-kasan-gce-root
2018/07/31 19:12 upstream c1d61e7fe376 1477993e .config console log report ci-upstream-kasan-gce-root
2018/07/31 17:31 upstream c1d61e7fe376 1a381291 .config console log report ci-upstream-kasan-gce-root
2018/07/31 16:23 upstream 527838d470e3 1a381291 .config console log report ci-upstream-kasan-gce-root
2018/07/12 08:08 upstream c25c74b7476e 2e0e3130 .config console log report ci-upstream-kasan-gce
2018/07/12 06:51 upstream c25c74b7476e 2e0e3130 .config console log report ci-upstream-kasan-gce-386
2018/07/19 06:25 linux-next 0b742fe187f7 49f35839 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.