syzbot


KASAN: use-after-free Read in set_de_name_and_namelen

Status: fixed on 2024/02/13 12:02
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+3969ffae9388a369bab8@syzkaller.appspotmail.com
Fix commit: 6f861765464f fs: Block writes to mounted block devices
First crash: 741d, last: 340d
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 set_de_name_and_namelen 1 (3) 2024/02/07 17:02
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/01/21 19:34 22m retest repro upstream OK log
2024/01/21 19:34 1h33m retest repro upstream OK log
2024/01/21 19:34 20m retest repro upstream OK log
2024/01/18 23:10 2h03m retest repro linux-next OK log
2024/01/18 23:10 31m retest repro linux-next OK log
2024/01/15 00:51 25m retest repro linux-next OK log
2024/01/14 21:54 20m retest repro upstream OK log
2024/01/14 13:39 21m retest repro upstream OK log
2023/12/30 23:55 16m retest repro upstream report log
2023/12/16 21:55 25m retest repro upstream report log
Fix bisection attempts (6)
Created Duration User Patch Repo Result
2024/02/03 14:56 5h04m (2) bisect fix upstream OK (1) job log
2023/08/08 03:28 1h39m bisect fix upstream OK (0) job log log
2023/05/07 08:35 25m bisect fix upstream OK (0) job log log
2023/04/07 07:10 47m bisect fix upstream OK (0) job log log
2023/03/08 06:28 42m bisect fix upstream OK (0) job log log
2023/02/06 05:46 41m bisect fix upstream OK (0) job log log

Sample crash report:
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using tea hash to sort names
REISERFS (device loop0): using 3.5.x disk format
==================================================================
BUG: KASAN: use-after-free in set_de_name_and_namelen+0x592/0x6a0 fs/reiserfs/namei.c:81
Read of size 1 at addr ffff88806aefef83 by task syz-executor239/5068

CPU: 1 PID: 5068 Comm: syz-executor239 Not tainted 6.7.0-rc2-syzkaller-00029-g9b6de136b5f0 #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+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 set_de_name_and_namelen+0x592/0x6a0 fs/reiserfs/namei.c:81
 linear_search_in_dir_item fs/reiserfs/namei.c:262 [inline]
 reiserfs_find_entry+0x481/0xe70 fs/reiserfs/namei.c:331
 reiserfs_lookup+0x1f5/0x690 fs/reiserfs/namei.c:368
 __lookup_slow+0x24d/0x450 fs/namei.c:1694
 lookup_one_len+0x17d/0x1b0 fs/namei.c:2746
 reiserfs_lookup_privroot+0x94/0x200 fs/reiserfs/xattr.c:977
 reiserfs_fill_super+0x20f9/0x3160 fs/reiserfs/super.c:2174
 mount_bdev+0x1f3/0x2e0 fs/super.c:1650
 legacy_get_tree+0x109/0x220 fs/fs_context.c:662
 vfs_get_tree+0x8c/0x370 fs/super.c:1771
 do_new_mount fs/namespace.c:3337 [inline]
 path_mount+0x1492/0x1ed0 fs/namespace.c:3664
 do_mount fs/namespace.c:3677 [inline]
 __do_sys_mount fs/namespace.c:3886 [inline]
 __se_sys_mount fs/namespace.c:3863 [inline]
 __x64_sys_mount+0x293/0x310 fs/namespace.c:3863
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f0a88ac7a7a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 1e 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007ffea62a5648 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffea62a5660 RCX: 00007f0a88ac7a7a
RDX: 0000000020000000 RSI: 0000000020000040 RDI: 00007ffea62a5660
RBP: 0000000000000004 R08: 00007ffea62a56a0 R09: 0000000000001117
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000000000
R13: 00007ffea62a56a0 R14: 0000000000000003 R15: 0000000000400000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001abbf80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x6aefe
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 ffffea0001abbfc8 ffffea0001abbf48 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x8(__GFP_MOVABLE), pid 1, tgid 1 (swapper/0), ts 11699634504, free_ts 12916778652
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1537
 split_map_pages+0x1ff/0x520 mm/compaction.c:97
 isolate_freepages_range+0x318/0x370 mm/compaction.c:774
 alloc_contig_range+0x32e/0x510 mm/page_alloc.c:6411
 __alloc_contig_pages mm/page_alloc.c:6434 [inline]
 alloc_contig_pages+0x31a/0x610 mm/page_alloc.c:6514
 debug_vm_pgtable_alloc_huge_page mm/debug_vm_pgtable.c:1095 [inline]
 init_args mm/debug_vm_pgtable.c:1277 [inline]
 debug_vm_pgtable+0x5d8/0x3250 mm/debug_vm_pgtable.c:1315
 do_one_initcall+0x11c/0x650 init/main.c:1236
 do_initcall_level init/main.c:1298 [inline]
 do_initcalls init/main.c:1314 [inline]
 do_basic_setup init/main.c:1333 [inline]
 kernel_init_freeable+0x687/0xc10 init/main.c:1551
 kernel_init+0x1c/0x2a0 init/main.c:1441
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242
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+0x4fa/0xaa0 mm/page_alloc.c:2347
 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487
 free_contig_range+0xb6/0x190 mm/page_alloc.c:6536
 destroy_args+0xa69/0xe40 mm/debug_vm_pgtable.c:1028
 debug_vm_pgtable+0x16fe/0x3250 mm/debug_vm_pgtable.c:1408
 do_one_initcall+0x11c/0x650 init/main.c:1236
 do_initcall_level init/main.c:1298 [inline]
 do_initcalls init/main.c:1314 [inline]
 do_basic_setup init/main.c:1333 [inline]
 kernel_init_freeable+0x687/0xc10 init/main.c:1551
 kernel_init+0x1c/0x2a0 init/main.c:1441
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242

Memory state around the buggy address:
 ffff88806aefee80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88806aefef00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88806aefef80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88806aeff000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88806aeff080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/11/23 13:45 upstream 9b6de136b5f0 03e12510 .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 set_de_name_and_namelen
2023/06/11 13:03 upstream 022ce8862dff 7086cdb9 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in set_de_name_and_namelen
2023/12/31 11:59 upstream 453f5db0619e fb427a07 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in set_de_name_and_namelen
2023/07/02 16:19 upstream 995b406c7e97 bfc47836 .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 set_de_name_and_namelen
2023/05/14 17:17 upstream bb7c241fae62 2b9ba477 .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 set_de_name_and_namelen
2022/12/10 04:51 upstream 0d1409e4ff08 67be1ae7 .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 set_de_name_and_namelen
2022/11/25 04:30 upstream c3eb11fbb826 74a66371 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in set_de_name_and_namelen
2023/08/11 19:14 linux-next 21ef7b1e17d0 39990d51 .config strace 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 set_de_name_and_namelen
2023/06/03 05:43 linux-next 715abedee4cd a4ae4f42 .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 set_de_name_and_namelen
2023/01/07 05:41 linux-next cc3c08b41a9c 1dac8c7a .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 set_de_name_and_namelen
2023/12/02 19:47 upstream 815fb87b7530 f819d6f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: use-after-free Read in set_de_name_and_namelen
2023/11/23 13:22 upstream 9b6de136b5f0 03e12510 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: use-after-free Read in set_de_name_and_namelen
2023/07/04 05:57 upstream a901a3568fd2 6e553898 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in set_de_name_and_namelen
2023/06/26 03:13 upstream 547cc9be86f4 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: use-after-free Read in set_de_name_and_namelen
2022/11/25 04:08 upstream c3eb11fbb826 74a66371 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in set_de_name_and_namelen
* Struck through repros no longer work on HEAD.