syzbot


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

Status: fixed on 2018/07/24 12:55
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+60c837b428dc84e83a93@syzkaller.appspotmail.com
Fix commit: 02f51d45937f autofs: fix slab out of bounds read in getname_kernel()
First crash: 2424d, last: 2324d
Discussions (5)
Title Replies (including bot) Last reply
[PATCH 4.17 000/101] 4.17.9-stable review 100 (101) 2018/07/22 11:42
[PATCH 4.14 00/92] 4.14.57-stable review 91 (92) 2018/07/21 13:41
[PATCH] autofs - fix slab out of bounds read in getname_kernel() 3 (3) 2018/07/06 01:08
[PATCH upstream] KASAN: slab-out-of-bounds Read in getname_kernel 10 (10) 2018/07/03 06:40
KASAN: slab-out-of-bounds Read in getname_kernel 0 (2) 2018/04/30 13:02
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: slab-out-of-bounds Read in getname_kernel C 6 2284d 2050d 0/3 public: reported C repro on 2019/04/14 00:00
upstream KASAN: slab-out-of-bounds Read in getname_kernel (2) btrfs C done 5 294d 341d 25/28 fixed on 2024/03/28 13:58

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
==================================================================
BUG: KASAN: slab-out-of-bounds in strlen+0x83/0xa0 lib/string.c:482
Read of size 1 at addr ffff8801d7039258 by task syz-executor745/4503

CPU: 0 PID: 4503 Comm: syz-executor745 Not tainted 4.17.0-rc7+ #78
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+0x1b9/0x294 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_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 strlen+0x83/0xa0 lib/string.c:482
 strlen include/linux/string.h:267 [inline]
 getname_kernel+0x24/0x370 fs/namei.c:218
 kern_path_mountpoint+0x23/0x40 fs/namei.c:2706
 find_autofs_mount.isra.5+0x8c/0x2b0 fs/autofs4/dev-ioctl.c:212
 autofs_dev_ioctl_open_mountpoint fs/autofs4/dev-ioctl.c:257 [inline]
 autofs_dev_ioctl_openmount+0x183/0x340 fs/autofs4/dev-ioctl.c:297
 _autofs_dev_ioctl+0x67a/0x890 fs/autofs4/dev-ioctl.c:697
 autofs_dev_ioctl+0x1b/0x30 fs/autofs4/dev-ioctl.c:713
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x1cf/0x16a0 fs/ioctl.c:684
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701
 __do_sys_ioctl fs/ioctl.c:708 [inline]
 __se_sys_ioctl fs/ioctl.c:706 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:706
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43fd19
RSP: 002b:00007fffa5b980a8 EFLAGS: 00000213 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043fd19
RDX: 0000000020000080 RSI: 8000000000009374 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000213 R12: 0000000000401640
R13: 00000000004016d0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4503:
 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
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc_track_caller+0x14a/0x760 mm/slab.c:3733
 memdup_user+0x2c/0xa0 mm/util.c:160
 copy_dev_ioctl fs/autofs4/dev-ioctl.c:109 [inline]
 _autofs_dev_ioctl+0x1a8/0x890 fs/autofs4/dev-ioctl.c:643
 autofs_dev_ioctl+0x1b/0x30 fs/autofs4/dev-ioctl.c:713
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x1cf/0x16a0 fs/ioctl.c:684
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701
 __do_sys_ioctl fs/ioctl.c:708 [inline]
 __se_sys_ioctl fs/ioctl.c:706 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:706
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 2842:
 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
 single_release+0x8f/0xb0 fs/seq_file.c:609
 __fput+0x34d/0x890 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x2bd/0x310 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ac/0x800 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801d7039240
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 24 bytes inside of
 32-byte region [ffff8801d7039240, ffff8801d7039260)
The buggy address belongs to the page:
page:ffffea00075c0e40 count:1 mapcount:0 mapping:ffff8801d7039000 index:0xffff8801d7039fc1
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801d7039000 ffff8801d7039fc1 000000010000003f
raw: ffffea00075c0c20 ffff8801da801248 ffff8801da8001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d7039100: 00 04 fc fc fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d7039180: fb fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
>ffff8801d7039200: fb fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
                                                    ^
 ffff8801d7039280: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d7039300: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/06/02 15:29 upstream 0512e0134582 2f93b54f .config console log report syz C ci-upstream-kasan-gce-root
2018/04/30 13:01 upstream 6da6c0db5316 06db3cec .config console log report syz C ci-upstream-kasan-gce-root
2018/04/05 16:01 upstream 06dd3dfeea60 5e1ccffc .config console log report syz ci-upstream-kasan-gce-root
2018/07/14 05:08 upstream 9d2e34897d8d 92a49505 .config console log report ci-upstream-kasan-gce-root
2018/06/24 17:50 upstream 7daf201d7fe8 2064fc5c .config console log report ci-upstream-kasan-gce-root
2018/06/02 15:13 upstream 0512e0134582 2f93b54f .config console log report ci-upstream-kasan-gce-root
2018/04/05 15:37 upstream 06dd3dfeea60 5e1ccffc .config console log report ci-upstream-kasan-gce-root
2018/07/09 16:03 linux-next d00d6d9a339d f25e5770 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.