syzbot


KASAN: use-after-free Read in io_uring_show_cred

Status: closed as dup on 2020/11/05 16:50
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+65731228192d0cafab77@syzkaller.appspotmail.com
First crash: 1274d, last: 1274d
Cause bisection: introduced by (bisect log) :
commit 1e6fa5216a0e59ef02e8b6b40d553238a3b81d49
Author: Jens Axboe <axboe@kernel.dk>
Date: Thu Oct 15 14:46:24 2020 +0000

  io_uring: COW io_identity on mismatch

Crash: BUG: unable to handle kernel NULL pointer dereference in io_uring_show_cred (log)
Repro: C syz .config
  
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
general protection fault in io_uring_show_cred fs C done 4 1274d 1273d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in io_uring_show_cred 1 (2) 2020/11/05 16:50

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in io_uring_show_cred+0x26e/0x4f0 fs/io_uring.c:8921
Read of size 8 at addr ffff88802110fd20 by task syz-executor339/8466

CPU: 0 PID: 8466 Comm: syz-executor339 Not tainted 5.10.0-rc2-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+0x137/0x1be lib/dump_stack.c:118
 print_address_description+0x6c/0x660 mm/kasan/report.c:385
 __kasan_report mm/kasan/report.c:545 [inline]
 kasan_report+0x136/0x1e0 mm/kasan/report.c:562
 io_uring_show_cred+0x26e/0x4f0 fs/io_uring.c:8921
 idr_for_each+0x16b/0x260 lib/idr.c:208
 __io_uring_show_fdinfo fs/io_uring.c:8974 [inline]
 io_uring_show_fdinfo+0x63f/0x990 fs/io_uring.c:8996
 seq_show+0x559/0x610 fs/proc/fd.c:65
 seq_read+0x41a/0xcd0 fs/seq_file.c:208
 do_loop_readv_writev fs/read_write.c:761 [inline]
 do_iter_read+0x48e/0x660 fs/read_write.c:803
 vfs_readv fs/read_write.c:921 [inline]
 do_preadv+0x17b/0x290 fs/read_write.c:1013
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x4403a9
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 db 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc85a4e508 EFLAGS: 00000246 ORIG_RAX: 0000000000000127
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004403a9
RDX: 0000000000000333 RSI: 00000000200017c0 RDI: 0000000000000004
RBP: 00000000006ca018 R08: 0000000000000000 R09: 65732f636f72702f
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401c10
R13: 0000000000401ca0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4874:
 kasan_save_stack mm/kasan/common.c:48 [inline]
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc+0x111/0x140 mm/kasan/common.c:461
 __kmalloc+0x170/0x290 mm/slub.c:3970
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 tomoyo_encode2+0x25a/0x560 security/tomoyo/realpath.c:45
 tomoyo_encode security/tomoyo/realpath.c:80 [inline]
 tomoyo_realpath_from_path+0x5c6/0x620 security/tomoyo/realpath.c:288
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_perm+0x191/0x570 security/tomoyo/file.c:822
 security_inode_getattr+0xc0/0x140 security/security.c:1279
 vfs_getattr fs/stat.c:121 [inline]
 vfs_fstat fs/stat.c:146 [inline]
 __do_sys_newfstat fs/stat.c:386 [inline]
 __se_sys_newfstat fs/stat.c:383 [inline]
 __x64_sys_newfstat+0x97/0x150 fs/stat.c:383
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 4874:
 kasan_save_stack mm/kasan/common.c:48 [inline]
 kasan_set_track+0x3d/0x70 mm/kasan/common.c:56
 kasan_set_free_info+0x17/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0x108/0x140 mm/kasan/common.c:422
 slab_free_hook mm/slub.c:1544 [inline]
 slab_free_freelist_hook+0xd6/0x1a0 mm/slub.c:1577
 slab_free mm/slub.c:3142 [inline]
 kfree+0xd1/0x280 mm/slub.c:4124
 tomoyo_path_perm+0x447/0x570 security/tomoyo/file.c:842
 security_inode_getattr+0xc0/0x140 security/security.c:1279
 vfs_getattr fs/stat.c:121 [inline]
 vfs_fstat fs/stat.c:146 [inline]
 __do_sys_newfstat fs/stat.c:386 [inline]
 __se_sys_newfstat fs/stat.c:383 [inline]
 __x64_sys_newfstat+0x97/0x150 fs/stat.c:383
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88802110fd00
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 32 bytes inside of
 96-byte region [ffff88802110fd00, ffff88802110fd60)
The buggy address belongs to the page:
page:00000000c5b3a963 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2110f
flags: 0xfff00000000200(slab)
raw: 00fff00000000200 ffffea0000a8e040 0000000200000002 ffff888010441780
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88802110fc00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
 ffff88802110fc80: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
>ffff88802110fd00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                               ^
 ffff88802110fd80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff88802110fe00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/11/05 06:17 upstream 4ef8451b3326 64069d48 .config console log report syz C ci-upstream-kasan-gce-smack-root
2020/11/04 17:19 upstream 4ef8451b3326 cba33199 .config console log report syz C ci-upstream-kasan-gce
2020/11/05 05:57 upstream 4ef8451b3326 64069d48 .config console log report info ci-upstream-kasan-gce-smack-root
2020/11/04 16:59 upstream 4ef8451b3326 cba33199 .config console log report info ci-upstream-kasan-gce
2020/11/05 05:54 linux-next cf7cd542d1b5 64069d48 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/11/05 05:54 linux-next cf7cd542d1b5 64069d48 .config console log report info ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.