syzbot


KASAN: slab-out-of-bounds Read in fscache_alloc_cookie

Status: fixed on 2018/10/30 01:28
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+a95b989b2dde8e806af8@syzkaller.appspotmail.com
Fix commit: 1ff22883b0b2 fscache: Fix incomplete initialisation of inline key space fa520c47eaa1 fscache: Fix out of bound read in long cookie keys
First crash: 2202d, last: 2100d
Discussions (6)
Title Replies (including bot) Last reply
[PATCH 0/4] FS-Cache: Miscellaneous fixes 13 (13) 2018/11/28 20:45
[PATCH 4.18 00/34] 4.18.18-stable review 41 (41) 2018/11/10 15:24
[PATCH 0/4] FS-Cache: Miscellaneous fixes 4 (4) 2018/10/17 14:17
[PATCH] fscache: Fix cookie key uninit mem / out of bound read 2 (2) 2018/09/25 19:25
[PATCH] fscache: fscache_set_key() - align alloc and usage 3 (3) 2018/08/03 17:26
KASAN: slab-out-of-bounds Read in fscache_alloc_cookie 1 (2) 2018/07/09 05:59

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in fscache_set_key fs/fscache/cookie.c:120 [inline]
BUG: KASAN: slab-out-of-bounds in fscache_alloc_cookie+0x7ad/0x880 fs/fscache/cookie.c:171
Read of size 4 at addr ffff8801d7ad4914 by task syz-executor062/5391

CPU: 1 PID: 5391 Comm: syz-executor062 Not tainted 4.19.0-rc8+ #285
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+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 fscache_set_key fs/fscache/cookie.c:120 [inline]
 fscache_alloc_cookie+0x7ad/0x880 fs/fscache/cookie.c:171
 __fscache_acquire_cookie+0x230/0xb60 fs/fscache/cookie.c:303
 fscache_acquire_cookie include/linux/fscache.h:338 [inline]
 nfs_fscache_get_client_cookie+0x463/0x600 fs/nfs/fscache.c:85
 nfs_alloc_client+0x563/0x760 fs/nfs/client.c:188
 nfs_get_client+0x8e8/0x14d0 fs/nfs/client.c:430
 nfs_init_server+0x357/0x1010 fs/nfs/client.c:670
 nfs_create_server+0x86/0x5f0 fs/nfs/client.c:954
 nfs_try_mount+0x180/0xa80 fs/nfs/super.c:1884
 nfs_fs_mount+0x17f8/0x2f1c fs/nfs/super.c:2695
 mount_fs+0xae/0x31d fs/super.c:1261
 vfs_kern_mount.part.35+0xdc/0x4f0 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2457 [inline]
 do_mount+0x581/0x31f0 fs/namespace.c:2787
 ksys_mount+0x12d/0x140 fs/namespace.c:3003
 __do_sys_mount fs/namespace.c:3017 [inline]
 __se_sys_mount fs/namespace.c:3014 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3014
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440129
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fff15a74048 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 0000000000440129
RDX: 000000002015bffc RSI: 0000000020343ff8 RDI: 00000000208deff8
RBP: 00000000006ca018 R08: 000000002000a000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000286 R12: 00000000004019b0
R13: 0000000000401a40 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 5391:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc+0x14e/0x760 mm/slab.c:3727
 kmalloc include/linux/slab.h:518 [inline]
 kzalloc include/linux/slab.h:707 [inline]
 fscache_set_key fs/fscache/cookie.c:101 [inline]
 fscache_alloc_cookie+0x6f7/0x880 fs/fscache/cookie.c:171
 __fscache_acquire_cookie+0x230/0xb60 fs/fscache/cookie.c:303
 fscache_acquire_cookie include/linux/fscache.h:338 [inline]
 nfs_fscache_get_client_cookie+0x463/0x600 fs/nfs/fscache.c:85
 nfs_alloc_client+0x563/0x760 fs/nfs/client.c:188
 nfs_get_client+0x8e8/0x14d0 fs/nfs/client.c:430
 nfs_init_server+0x357/0x1010 fs/nfs/client.c:670
 nfs_create_server+0x86/0x5f0 fs/nfs/client.c:954
 nfs_try_mount+0x180/0xa80 fs/nfs/super.c:1884
 nfs_fs_mount+0x17f8/0x2f1c fs/nfs/super.c:2695
 mount_fs+0xae/0x31d fs/super.c:1261
 vfs_kern_mount.part.35+0xdc/0x4f0 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2457 [inline]
 do_mount+0x581/0x31f0 fs/namespace.c:2787
 ksys_mount+0x12d/0x140 fs/namespace.c:3003
 __do_sys_mount fs/namespace.c:3017 [inline]
 __se_sys_mount fs/namespace.c:3014 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3014
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 1:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3813
 acpi_os_free include/acpi/platform/aclinuxex.h:62 [inline]
 acpi_ns_get_node_unlocked+0x2b9/0x309 drivers/acpi/acpica/nsutils.c:698
 acpi_ns_get_node+0x4d/0x6b drivers/acpi/acpica/nsutils.c:738
 acpi_ns_evaluate+0xf3/0x9bc drivers/acpi/acpica/nseval.c:68
 acpi_ut_evaluate_object+0x12b/0x425 drivers/acpi/acpica/uteval.c:60
 acpi_ut_execute_power_methods+0xf1/0x22a drivers/acpi/acpica/uteval.c:288
 acpi_get_object_info+0x6ac/0xd1b drivers/acpi/acpica/nsxfname.c:366
 acpi_set_pnp_ids drivers/acpi/scan.c:1247 [inline]
 acpi_init_device_object+0x12a0/0x1e20 drivers/acpi/scan.c:1589
 acpi_add_single_object+0x1d2/0x1ed0 drivers/acpi/scan.c:1624
 acpi_bus_check_add+0x5e0/0xb10 drivers/acpi/scan.c:1877
 acpi_ns_walk_namespace+0x224/0x400 drivers/acpi/acpica/nswalk.c:237
 acpi_walk_namespace+0xf2/0x12c drivers/acpi/acpica/nsxfeval.c:606
 acpi_bus_scan+0x146/0x170 drivers/acpi/scan.c:2058
 acpi_scan_init+0x403/0x8fe drivers/acpi/scan.c:2215
 acpi_init+0x941/0xa19 drivers/acpi/bus.c:1261
 do_one_initcall+0x145/0x957 init/main.c:885
 do_initcall_level init/main.c:953 [inline]
 do_initcalls init/main.c:961 [inline]
 do_basic_setup init/main.c:979 [inline]
 kernel_init_freeable+0x4bb/0x5ae init/main.c:1144
 kernel_init+0x11/0x1b2 init/main.c:1063
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413

The buggy address belongs to the object at ffff8801d7ad4900
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 20 bytes inside of
 32-byte region [ffff8801d7ad4900, ffff8801d7ad4920)
The buggy address belongs to the page:
page:ffffea00075eb500 count:1 mapcount:0 mapping:ffff8801da8001c0 index:0xffff8801d7ad4fc1
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00075ea688 ffff8801da801238 ffff8801da8001c0
raw: ffff8801d7ad4fc1 ffff8801d7ad4000 0000000100000038 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d7ad4800: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d7ad4880: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8801d7ad4900: 00 00 06 fc fc fc fc fc 01 fc fc fc fc fc fc fc
                         ^
 ffff8801d7ad4980: 01 fc fc fc fc fc fc fc 01 fc fc fc fc fc fc fc
 ffff8801d7ad4a00: 01 fc fc fc fc fc fc fc 04 fc fc fc fc fc fc fc
==================================================================

Crashes (1936):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/10/15 22:01 upstream f0a7d1883d9f 8cd30605 .config console log report syz C ci-upstream-kasan-gce-root
2018/10/15 22:01 upstream f0a7d1883d9f 8cd30605 .config console log report syz C ci-upstream-kasan-gce
2018/10/15 21:33 upstream f0a7d1883d9f 8cd30605 .config console log report syz C ci-upstream-kasan-gce-smack-root
2018/10/15 20:24 upstream f0a7d1883d9f 8cd30605 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2018/10/14 13:05 upstream 3a27203102eb caf12900 .config console log report syz C ci-upstream-kasan-gce-root
2018/10/14 03:54 upstream 7ec21823634d caf12900 .config console log report syz C ci-upstream-kasan-gce-smack-root
2018/10/14 03:47 upstream 7ec21823634d caf12900 .config console log report syz C ci-upstream-kasan-gce
2018/10/14 03:32 upstream 7ec21823634d caf12900 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2018/09/12 10:55 upstream 5e335542de83 3c88136c .config console log report syz C ci-upstream-kasan-gce-smack-root
2018/09/10 17:49 upstream 11da3a7f84f1 f167cb6b .config console log report syz C ci-upstream-kasan-gce
2018/09/09 14:49 upstream f8f65382c98a 6b5120a4 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2018/09/09 08:46 upstream f8f65382c98a 6b5120a4 .config console log report syz C ci-upstream-kasan-gce-root
2018/09/09 03:53 upstream d7b686ebf704 6b5120a4 .config console log report syz C ci-upstream-kasan-gce-smack-root
2018/09/08 11:50 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz C ci-upstream-kasan-gce
2018/07/28 09:28 upstream 864af0d40cdc ebf656d7 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/09 22:28 upstream 1e4b044d2251 f25e5770 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/09 15:04 upstream 1e4b044d2251 f25e5770 .config console log report syz C ci-upstream-kasan-gce
2018/07/09 06:15 upstream ca04b3cca11a f25e5770 .config console log report syz C ci-upstream-kasan-gce
2018/07/09 03:07 upstream ca04b3cca11a f25e5770 .config console log report syz C ci-upstream-kasan-gce-root
2018/10/15 21:56 upstream f0a7d1883d9f 8cd30605 .config console log report syz C ci-upstream-kasan-gce-386
2018/09/09 23:16 upstream 9a5682765a2e 6b5120a4 .config console log report syz C ci-upstream-kasan-gce-386
2018/09/08 10:11 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz C ci-upstream-kasan-gce-386
2018/07/09 06:54 upstream ca04b3cca11a f25e5770 .config console log report syz C ci-upstream-kasan-gce-386
2018/07/09 00:02 upstream ca04b3cca11a f25e5770 .config console log report syz C ci-upstream-kasan-gce-386
2018/10/15 20:37 linux-next ca0591d03a2d 8cd30605 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/07/28 09:25 linux-next d1e0b8e0cb7a ebf656d7 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/07/09 14:54 linux-next d00d6d9a339d f25e5770 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/10/18 15:51 upstream 9bd871df56a7 d257b2d2 .config console log report ci-upstream-kasan-gce
2018/10/18 11:26 upstream 9bd871df56a7 d257b2d2 .config console log report ci-upstream-kasan-gce
2018/10/18 01:48 upstream c343db455eb3 b2695b95 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/17 23:08 upstream c343db455eb3 b2695b95 .config console log report ci-upstream-kasan-gce-smack-root
2018/10/17 14:25 upstream c0cff31be705 1ba7fd7e .config console log report ci-upstream-kasan-gce
2018/10/17 11:11 upstream b955a910d7fd 1ba7fd7e .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/17 08:02 upstream b955a910d7fd 1ba7fd7e .config console log report ci-upstream-kasan-gce-root
2018/10/16 23:03 upstream b955a910d7fd 1ba7fd7e .config console log report ci-upstream-kasan-gce
2018/10/16 19:48 upstream b955a910d7fd 1ba7fd7e .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/16 19:26 upstream b955a910d7fd 1ba7fd7e .config console log report ci-upstream-kasan-gce
2018/10/16 07:53 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-smack-root
2018/10/16 07:30 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-root
2018/10/16 05:38 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/16 04:29 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-root
2018/10/16 01:19 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce
2018/10/16 01:05 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/15 19:39 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-smack-root
2018/10/15 12:04 upstream 35a7f35ad1b1 caf12900 .config console log report ci-upstream-kasan-gce-root
2018/10/15 08:22 upstream 35a7f35ad1b1 caf12900 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/14 17:39 upstream 3a27203102eb caf12900 .config console log report ci-upstream-kasan-gce-root
2018/10/14 05:31 upstream 7ec21823634d caf12900 .config console log report ci-upstream-kasan-gce-smack-root
2018/10/13 20:54 upstream 7ec21823634d caf12900 .config console log report ci-upstream-kasan-gce
2018/10/13 14:57 upstream bab5c80b2110 caf12900 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/13 14:57 upstream bab5c80b2110 caf12900 .config console log report ci-upstream-kasan-gce
2018/10/18 17:10 upstream 9bd871df56a7 d257b2d2 .config console log report ci-upstream-kasan-gce-386
2018/10/17 16:30 upstream c0cff31be705 1ba7fd7e .config console log report ci-upstream-kasan-gce-386
2018/10/17 10:16 upstream b955a910d7fd 1ba7fd7e .config console log report ci-upstream-kasan-gce-386
2018/10/16 09:24 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-386
2018/10/15 20:35 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce-386
2018/10/18 11:26 linux-next 9bab64345e83 d257b2d2 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/18 06:46 linux-next 4efacb725c0e b2695b95 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/18 02:55 linux-next 4efacb725c0e b2695b95 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/17 16:29 linux-next 4efacb725c0e 1ba7fd7e .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/17 13:06 linux-next 4efacb725c0e 1ba7fd7e .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/17 10:16 linux-next 4efacb725c0e 1ba7fd7e .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/17 01:11 linux-next 6d5d82417dd6 1ba7fd7e .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/16 09:24 linux-next 6d5d82417dd6 8cd30605 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/16 01:05 linux-next ca0591d03a2d 8cd30605 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/15 00:54 linux-next 774ea0551a29 caf12900 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/14 15:50 linux-next 774ea0551a29 caf12900 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/14 01:24 linux-next 774ea0551a29 caf12900 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.