syzbot


KASAN: use-after-free Read in leaf_paste_in_buffer

Status: upstream: reported C repro on 2022/12/01 11:54
Reported-by: syzbot+55b82aea13452e3d128f@syzkaller.appspotmail.com
First crash: 66d, last: 2d08h

Cause bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: out-of-bounds Read in leaf_paste_in_buffer reiserfs C 6 2d05h 63d 0/1 upstream: reported C repro on 2022/12/03 21:39
linux-4.19 KASAN: out-of-bounds Read in leaf_paste_in_buffer reiserfs C 12 8d12h 70d 0/1 upstream: reported C repro on 2022/11/27 00:33

Sample crash report:
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 leaf_paste_in_buffer+0xa2d/0xc30 fs/reiserfs/lbalance.c:1043
Read of size 104 at addr ffff888071e4bfd8 by task syz-executor314/5067

CPU: 1 PID: 5067 Comm: syz-executor314 Not tainted 6.2.0-rc6-syzkaller-00050-g9f266ccaa2f5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
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
 memcpy+0x24/0x60 mm/kasan/shadow.c:65
 leaf_paste_in_buffer+0xa2d/0xc30 fs/reiserfs/lbalance.c:1043
 leaf_copy_dir_entries.isra.0+0x7f3/0x980 fs/reiserfs/lbalance.c:108
 leaf_copy_boundary_item fs/reiserfs/lbalance.c:168 [inline]
 leaf_copy_items fs/reiserfs/lbalance.c:551 [inline]
 leaf_move_items+0x16d2/0x3ad0 fs/reiserfs/lbalance.c:726
 leaf_shift_left+0xa4/0x380 fs/reiserfs/lbalance.c:750
 balance_leaf_left fs/reiserfs/do_balan.c:616 [inline]
 balance_leaf+0x3337/0xde40 fs/reiserfs/do_balan.c:1409
 do_balance+0x319/0x810 fs/reiserfs/do_balan.c:1888
 reiserfs_insert_item+0xdb2/0x11b0 fs/reiserfs/stree.c:2261
 reiserfs_get_block+0x1b23/0x4150 fs/reiserfs/inode.c:868
 __block_write_begin_int+0x3bd/0x14b0 fs/buffer.c:1991
 reiserfs_write_begin+0x36e/0xa60 fs/reiserfs/inode.c:2775
 generic_cont_expand_simple+0x117/0x1f0 fs/buffer.c:2347
 reiserfs_setattr+0x39a/0x1460 fs/reiserfs/inode.c:3305
 notify_change+0xca7/0x1420 fs/attr.c:482
 do_truncate+0x143/0x200 fs/open.c:65
 do_sys_ftruncate+0x51f/0x710 fs/open.c:193
 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:0x7f4ed201fa09
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:00007ffe38d5a2d8 EFLAGS: 00000246 ORIG_RAX: 000000000000004d
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f4ed201fa09
RDX: 00007f4ed201fa09 RSI: 0000000002007ffb RDI: 0000000000000006
RBP: 0000000000000000 R08: 00007ffe38d5a300 R09: 00007ffe38d5a300
R10: 00007ffe38d5a300 R11: 0000000000000246 R12: 00007ffe38d5a2fc
R13: 00007ffe38d5a330 R14: 00007ffe38d5a310 R15: 0000000000000001
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001c792c0 refcount:2 mapcount:0 mapping:ffff888144c49df8 index:0x213 pfn:0x71e4b
memcg:ffff88813ff40000
aops:def_blk_aops ino:700000
flags: 0xfff00000002032(referenced|lru|active|private|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000002032 ffffea0001c79288 ffffea00006fec48 ffff888144c49df8
raw: 0000000000000213 ffff8880728d5658 00000002ffffffff ffff88813ff40000
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 5067, tgid 5067 (syz-executor314), ts 42577079040, free_ts 9666845253
 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:2286
 folio_alloc+0x20/0x70 mm/mempolicy.c:2296
 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+0x72/0x80 fs/buffer.c:1333
 sb_getblk include/linux/buffer_head.h:356 [inline]
 search_by_key+0x3ac/0x3bf0 fs/reiserfs/stree.c:672
 reiserfs_read_locked_inode+0x158/0x2160 fs/reiserfs/inode.c:1549
 reiserfs_fill_super+0x1273/0x2e90 fs/reiserfs/super.c:2071
 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
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+0x1d/0x490 mm/page_alloc.c:3464
 free_contig_range+0xb5/0x180 mm/page_alloc.c:9485
 destroy_args+0xa8/0x64c mm/debug_vm_pgtable.c:998
 debug_vm_pgtable+0x28de/0x296f mm/debug_vm_pgtable.c:1318
 do_one_initcall+0x141/0x790 init/main.c:1306
 do_initcall_level init/main.c:1379 [inline]
 do_initcalls init/main.c:1395 [inline]
 do_basic_setup init/main.c:1414 [inline]
 kernel_init_freeable+0x6f9/0x782 init/main.c:1634
 kernel_init+0x1e/0x1d0 init/main.c:1522
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffff888071e4bf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888071e4bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888071e4c000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888071e4c080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888071e4c100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (62):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2023/02/03 01:39 upstream 9f266ccaa2f5 16d19e30 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/26 23:13 upstream 1b929c02afd3 9da18ae8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in leaf_paste_in_buffer
ci-upstream-kasan-gce-root 2022/12/25 08:32 upstream 72a85e2b0a1e 9da18ae8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/23 13:48 upstream 8395ae05cb5a 9da18ae8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/22 17:45 upstream 0a924817d2ed 9da18ae8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in leaf_paste_in_buffer
ci-upstream-kasan-gce-root 2022/12/12 15:26 upstream 830b3c68c1fb 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/01 10:38 upstream 04aa64375f48 4c2a66e8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/24 16:41 upstream 51094a24b85e 9da18ae8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Write in leaf_paste_in_buffer
ci-upstream-kasan-gce-root 2023/02/01 20:31 upstream c0b67534c95c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/16 08:49 upstream 5dc4c995db9e a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/10 19:03 upstream 5a41237ad1d4 48bc529a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/07 14:23 upstream 1f5abbd77e2c 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/31 14:49 upstream bff687b3dad6 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/31 12:43 upstream bff687b3dad6 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/30 15:11 upstream 2258c2dc850b 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/29 03:16 upstream 1b929c02afd3 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/27 14:35 upstream 1b929c02afd3 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/26 22:02 upstream 1b929c02afd3 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/26 09:08 upstream 1b929c02afd3 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/24 12:25 upstream 51094a24b85e 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/23 13:30 upstream 8395ae05cb5a 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/23 00:09 upstream 0a924817d2ed 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/22 10:57 upstream b6bb9676f216 4067838e .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/21 23:09 upstream b6bb9676f216 4067838e .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/20 16:02 upstream 6feb57c2fd7c c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/20 15:11 upstream aeba12b26c79 c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci-upstream-kasan-gce-root 2022/12/19 22:11 upstream 2f26e424552e c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/19 20:30 upstream aeba12b26c79 c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci-upstream-kasan-gce-root 2022/12/19 11:10 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/19 10:26 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/19 08:11 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/19 05:47 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/18 10:44 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/18 09:28 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/18 01:54 upstream 77856d911a8c 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/18 01:13 upstream 77856d911a8c 05494336 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/16 05:38 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/16 00:12 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/15 23:10 upstream 041fae9c105a 6f9c033e .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/15 09:55 upstream e2ca6ba6ba01 b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/15 06:11 upstream e2ca6ba6ba01 b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/14 23:50 upstream e2ca6ba6ba01 b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/13 07:11 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/13 05:27 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/13 01:06 upstream 830b3c68c1fb 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/12 09:11 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/11 15:44 upstream 296a7b7eb792 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/08 19:29 upstream 479174d402bc 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/04 09:51 upstream c2bf05db6c78 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/02 10:13 upstream ef4d3ea40565 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/01 10:20 upstream 04aa64375f48 4c2a66e8 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci-qemu-upstream-386 2022/12/13 03:50 upstream eb4511538191 67be1ae7 .config console log report info KASAN: use-after-free Read in leaf_paste_in_buffer
ci-upstream-linux-next-kasan-gce-root 2022/12/20 07:33 linux-next e45fb347b630 c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/20 05:24 upstream 081edded9b38 71197f3a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/17 02:31 upstream d532dd102151 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Write in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/16 17:08 upstream 5dc4c995db9e a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/16 06:30 upstream 5dc4c995db9e a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/15 05:41 upstream 97ec4d559d93 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/12 23:13 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
ci-upstream-kasan-gce-selinux-root 2023/01/12 04:57 upstream 7dd4b804e080 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
ci2-upstream-fs 2023/01/02 21:24 upstream 88603b6dc419 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
ci2-upstream-fs 2022/12/19 21:26 upstream aeba12b26c79 c52b2efb .config console log report info [disk image] [vmlinux] [kernel image] KASAN: out-of-bounds Read in leaf_paste_in_buffer
* Struck through repros no longer work on HEAD.