syzbot


KASAN: use-after-free Read in reiserfs_release_objectid

Status: upstream: reported C repro on 2022/11/29 10:22
Reported-by: syzbot+909a2191a4352fd77d25@syzkaller.appspotmail.com
First crash: 68d, last: 21d

Cause bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in reiserfs_release_objectid C 1 6d12h 62d 0/1 upstream: reported C repro on 2022/12/04 21:28
linux-4.19 KASAN: use-after-free Read in reiserfs_release_objectid C error 1 68d 68d 0/1 upstream: reported C repro on 2022/11/28 17:34

Sample crash report:
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
==================================================================
BUG: KASAN: use-after-free in reiserfs_release_objectid+0x50c/0x750 fs/reiserfs/objectid.c:165
Read of size 14568 at addr ffff8880726120d0 by task syz-executor227/5066

CPU: 0 PID: 5066 Comm: syz-executor227 Not tainted 6.1.0-syzkaller-13031-g77856d911a8c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:306 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:417
 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x141/0x190 mm/kasan/generic.c:189
 memmove+0x24/0x60 mm/kasan/shadow.c:54
 reiserfs_release_objectid+0x50c/0x750 fs/reiserfs/objectid.c:165
 remove_save_link+0x220/0x3f0 fs/reiserfs/super.c:542
 reiserfs_evict_inode+0x48d/0x540 fs/reiserfs/inode.c:91
 evict+0x2ed/0x6b0 fs/inode.c:664
 iput_final fs/inode.c:1747 [inline]
 iput.part.0+0x59b/0x880 fs/inode.c:1773
 iput+0x5c/0x80 fs/inode.c:1763
 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
 __dentry_kill+0x3c0/0x640 fs/dcache.c:607
 dentry_kill fs/dcache.c:745 [inline]
 dput+0x651/0xdb0 fs/dcache.c:913
 do_renameat2+0xb32/0xc30 fs/namei.c:4932
 __do_sys_rename fs/namei.c:4976 [inline]
 __se_sys_rename fs/namei.c:4974 [inline]
 __x64_sys_rename+0x81/0xa0 fs/namei.c:4974
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fafec354969
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcb5026c88 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 0031656c69662f2e RCX: 00007fafec354969
RDX: 00007fafec354969 RSI: 0000000020000200 RDI: 0000000020000140
RBP: 0000000000000000 R08: 00007ffcb5026cb0 R09: 00007ffcb5026cb0
R10: 00007ffcb5026cb0 R11: 0000000000000246 R12: 00007ffcb5026cac
R13: 00007ffcb5026ce0 R14: 00007ffcb5026cc0 R15: 0000000000000001
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001c98480 refcount:3 mapcount:0 mapping:ffff888144c7bef8 index:0x10 pfn:0x72612
memcg:ffff888140140000
aops:def_blk_aops ino:700000
flags: 0xfff00000022026(referenced|uptodate|active|private|mappedtodisk|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000022026 0000000000000000 dead000000000122 ffff888144c7bef8
raw: 0000000000000010 ffff88807b93d488 00000003ffffffff ffff888140140000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 5066, tgid 5066 (syz-executor227), ts 53636248254, free_ts 53566130904
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285
 folio_alloc+0x20/0x70 mm/mempolicy.c:2295
 filemap_alloc_folio+0x362/0x450 mm/filemap.c:972
 __filemap_get_folio+0x32c/0xd80 mm/filemap.c:1966
 pagecache_get_page+0x2e/0x280 mm/folio-compat.c:98
 find_or_create_page include/linux/pagemap.h:612 [inline]
 grow_dev_page fs/buffer.c:946 [inline]
 grow_buffers fs/buffer.c:1011 [inline]
 __getblk_slow+0x1f4/0x1030 fs/buffer.c:1038
 __getblk_gfp fs/buffer.c:1333 [inline]
 __bread_gfp+0x22c/0x330 fs/buffer.c:1367
 sb_bread include/linux/buffer_head.h:338 [inline]
 read_super_block+0x83/0x930 fs/reiserfs/super.c:1604
 reiserfs_fill_super+0x9dd/0x2e90 fs/reiserfs/super.c:1966
 mount_bdev+0x351/0x410 fs/super.c:1359
 legacy_get_tree+0x109/0x220 fs/fs_context.c:610
 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489
 do_new_mount fs/namespace.c:3145 [inline]
 path_mount+0x132a/0x1e20 fs/namespace.c:3475
 do_mount fs/namespace.c:3488 [inline]
 __do_sys_mount fs/namespace.c:3697 [inline]
 __se_sys_mount fs/namespace.c:3674 [inline]
 __x64_sys_mount+0x283/0x300 fs/namespace.c:3674
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1446 [inline]
 free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496
 free_unref_page_prepare mm/page_alloc.c:3369 [inline]
 free_unref_page_list+0x176/0xcd0 mm/page_alloc.c:3510
 release_pages+0xcb1/0x1330 mm/swap.c:1076
 __pagevec_release+0x77/0xe0 mm/swap.c:1096
 pagevec_release include/linux/pagevec.h:71 [inline]
 folio_batch_release include/linux/pagevec.h:135 [inline]
 shmem_undo_range+0x595/0x1340 mm/shmem.c:949
 shmem_truncate_range mm/shmem.c:1044 [inline]
 shmem_evict_inode+0x32f/0xb60 mm/shmem.c:1153
 evict+0x2ed/0x6b0 fs/inode.c:664
 iput_final fs/inode.c:1747 [inline]
 iput.part.0+0x59b/0x880 fs/inode.c:1773
 iput+0x5c/0x80 fs/inode.c:1763
 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
 __dentry_kill+0x3c0/0x640 fs/dcache.c:607
 dentry_kill fs/dcache.c:733 [inline]
 dput+0x80a/0xdb0 fs/dcache.c:913
 __fput+0x3cc/0xa90 fs/file_table.c:328
 task_work_run+0x16f/0x270 kernel/task_work.c:179
 ptrace_notify+0x118/0x140 kernel/signal.c:2354
 ptrace_report_syscall include/linux/ptrace.h:411 [inline]
 ptrace_report_syscall_exit include/linux/ptrace.h:473 [inline]
 syscall_exit_work kernel/entry/common.c:251 [inline]
 syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:278

Memory state around the buggy address:
 ffff888072614f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888072614f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888072615000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888072615080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888072615100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/12/17 06:10 upstream 77856d911a8c 05494336 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in reiserfs_release_objectid
ci2-upstream-fs 2022/11/29 10:12 upstream ca57f02295f1 ca9683b8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in reiserfs_release_objectid
ci-upstream-linux-next-kasan-gce-root 2023/01/14 22:14 linux-next 0a093b2893c7 a63719e7 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in reiserfs_release_objectid
* Struck through repros no longer work on HEAD.