syzbot


KASAN: use-after-free Read in reiserfs_release_objectid

Status: auto-obsoleted due to no activity on 2024/05/25 08:15
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+909a2191a4352fd77d25@syzkaller.appspotmail.com
First crash: 758d, last: 357d
Cause bisection: failed (error log, bisect log)
  
Fix bisection: fixed by (bisect log) :
commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
Date: Wed Nov 1 17:43:10 2023 +0000

  fs: Block writes to mounted block devices

  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] KASAN: use-after-free Read in reiserfs_release_objectid 0 (2) 2024/02/12 11:07
Similar bugs (4)
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 665d 753d 0/1 upstream: reported C repro on 2022/12/04 21:28
linux-6.1 KASAN: use-after-free Read in reiserfs_release_objectid 1 627d 627d 0/3 auto-obsoleted due to no activity on 2023/08/07 07:31
linux-5.15 KASAN: use-after-free Read in reiserfs_release_objectid origin:upstream C error 30 10d 155d 0/3 upstream: reported C repro on 2024/07/24 14:44
linux-4.19 KASAN: use-after-free Read in reiserfs_release_objectid reiserfs C error 2 683d 759d 0/1 upstream: reported C repro on 2022/11/28 17:34
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/05/25 07:49 25m retest repro upstream OK log
2024/03/15 04:18 22m retest repro upstream error
2024/01/25 00:07 22m retest repro upstream OK log
2024/01/20 11:12 23m retest repro linux-next OK log
2024/01/18 16:20 24m retest repro upstream OK log
2023/12/05 13:16 14m retest repro upstream report log
2023/11/11 04:51 2m retest repro linux-next error
2023/10/30 17:43 28m retest repro upstream report log
2023/09/09 23:30 10m retest repro upstream report log
2023/09/02 04:23 26m retest repro linux-next report log
Fix bisection attempts (10)
Created Duration User Patch Repo Result
2024/02/12 04:27 6h39m bisect fix upstream OK (1) job log
2024/01/04 14:12 2h05m bisect fix upstream OK (0) job log log
2023/11/15 22:27 1h16m bisect fix upstream OK (0) job log log
2023/10/16 10:06 1h13m bisect fix upstream OK (0) job log log
2023/08/16 13:39 1h47m bisect fix upstream OK (0) job log log
2023/07/01 20:16 51m bisect fix upstream OK (0) job log log
2023/06/01 19:22 31m bisect fix upstream OK (0) job log log
2023/05/02 18:35 47m bisect fix upstream OK (0) job log log
2023/03/15 22:42 38m bisect fix upstream OK (0) job log log
2023/02/13 22:14 27m bisect fix upstream OK (0) job log log

Sample crash report:
REISERFS warning (device loop0): vs-13060 reiserfs_update_sd_size: stat data of object [1 2 0x0 SD] (nlink == 1) not found (pos 2)
REISERFS warning (device loop0): vs-13060 reiserfs_update_sd_size: stat data of object [1 2 0x0 SD] (nlink == 1) not found (pos 2)
==================================================================
BUG: KASAN: use-after-free in reiserfs_release_objectid+0x510/0x770 fs/reiserfs/objectid.c:165
Read of size 7172 at addr ffff888076522050 by task syz-executor213/5105

CPU: 1 PID: 5105 Comm: syz-executor213 Not tainted 6.7.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:475
 kasan_report+0x142/0x170 mm/kasan/report.c:588
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:187
 __asan_memmove+0x29/0x70 mm/kasan/shadow.c:94
 reiserfs_release_objectid+0x510/0x770 fs/reiserfs/objectid.c:165
 remove_save_link+0x357/0x540 fs/reiserfs/super.c:542
 reiserfs_evict_inode+0x362/0x470 fs/reiserfs/inode.c:91
 evict+0x2a4/0x630 fs/inode.c:664
 d_delete_notify include/linux/fsnotify.h:262 [inline]
 vfs_rmdir+0x385/0x4c0 fs/namei.c:4202
 do_rmdir+0x3b5/0x580 fs/namei.c:4248
 __do_sys_rmdir fs/namei.c:4267 [inline]
 __se_sys_rmdir fs/namei.c:4265 [inline]
 __x64_sys_rmdir+0x49/0x50 fs/namei.c:4265
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x45/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f16a9c9d129
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 18 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe9748ec38 EFLAGS: 00000246 ORIG_RAX: 0000000000000054
RAX: ffffffffffffffda RBX: 0031656c69662f2e RCX: 00007f16a9c9d129
RDX: 00007f16a9c9d129 RSI: 00007f16a9c9d129 RDI: 0000000020000000
RBP: 0000000000000004 R08: 000000000000800c R09: 000000000000800c
R10: 000000000000800c R11: 0000000000000246 R12: 00007ffe9748ec80
R13: 00007ffe9748ecc0 R14: 0000000000400000 R15: 0000000000000003
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001d94880 refcount:2 mapcount:0 mapping:ffff88801b2ac1f8 index:0x10 pfn:0x76522
memcg:ffff888016262000
aops:def_blk_aops ino:700000
flags: 0xfff0000002812c(referenced|uptodate|lru|active|private|mappedtodisk|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff0000002812c ffffea0001d94848 ffffea000070f4c8 ffff88801b2ac1f8
raw: 0000000000000010 ffff888079b9dae0 00000002ffffffff ffff888016262000
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 5105, tgid 5105 (syz-executor213), ts 83910640952, free_ts 83673623680
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1537
 prep_new_page mm/page_alloc.c:1544 [inline]
 get_page_from_freelist+0x33ea/0x3570 mm/page_alloc.c:3312
 __alloc_pages+0x255/0x680 mm/page_alloc.c:4568
 alloc_pages_mpol+0x3de/0x640 mm/mempolicy.c:2133
 alloc_pages mm/mempolicy.c:2204 [inline]
 folio_alloc+0x12a/0x330 mm/mempolicy.c:2211
 filemap_alloc_folio+0xde/0x500 mm/filemap.c:974
 __filemap_get_folio+0x431/0xbb0 mm/filemap.c:1918
 grow_dev_page fs/buffer.c:1041 [inline]
 grow_buffers fs/buffer.c:1106 [inline]
 __getblk_slow fs/buffer.c:1133 [inline]
 bdev_getblk+0x246/0x6d0 fs/buffer.c:1429
 __bread_gfp+0xaf/0x430 fs/buffer.c:1474
 sb_bread include/linux/buffer_head.h:324 [inline]
 read_super_block+0x91/0x800 fs/reiserfs/super.c:1604
 reiserfs_fill_super+0x912/0x2620 fs/reiserfs/super.c:1966
 mount_bdev+0x237/0x300 fs/super.c:1650
 legacy_get_tree+0xef/0x190 fs/fs_context.c:662
 vfs_get_tree+0x8c/0x2a0 fs/super.c:1771
 do_new_mount+0x28f/0xae0 fs/namespace.c:3337
 do_mount fs/namespace.c:3677 [inline]
 __do_sys_mount fs/namespace.c:3886 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3863
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1137 [inline]
 free_unref_page_prepare+0x931/0xa60 mm/page_alloc.c:2347
 free_unref_page_list+0x5a0/0x840 mm/page_alloc.c:2533
 release_pages+0x2117/0x2400 mm/swap.c:1042
 __folio_batch_release+0x84/0x100 mm/swap.c:1062
 folio_batch_release include/linux/pagevec.h:83 [inline]
 truncate_inode_pages_range+0x457/0xf70 mm/truncate.c:371
 kill_bdev block/bdev.c:76 [inline]
 blkdev_flush_mapping+0x15c/0x2b0 block/bdev.c:630
 blkdev_put_whole block/bdev.c:661 [inline]
 blkdev_put+0x4a9/0x770 block/bdev.c:942
 bdev_release+0x57/0x70 block/bdev.c:952
 deactivate_locked_super+0xc1/0x130 fs/super.c:484
 cleanup_mnt+0x426/0x4c0 fs/namespace.c:1256
 task_work_run+0x24a/0x300 kernel/task_work.c:180
 ptrace_notify+0x2cd/0x380 kernel/signal.c:2399
 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 kernel/entry/common.c:278 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x168/0x2a0 kernel/entry/common.c:296
 do_syscall_64+0x52/0x110 arch/x86/entry/common.c:88
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Memory state around the buggy address:
 ffff888076522f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888076522f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888076523000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888076523080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888076523100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

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