syzbot


KASAN: out-of-bounds Read in leaf_paste_in_buffer

Status: upstream: reported C repro on 2022/11/27 00:33
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+684b490648932546ad60@syzkaller.appspotmail.com
First crash: 755d, last: 682d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: out-of-bounds Read in leaf_paste_in_buffer origin:upstream missing-backport C error 135 8d09h 551d 0/3 upstream: reported C repro on 2023/06/18 14:09
linux-4.14 KASAN: out-of-bounds Read in leaf_paste_in_buffer reiserfs C 6 657d 748d 0/1 upstream: reported C repro on 2022/12/03 21:39
upstream KASAN: use-after-free Read in leaf_paste_in_buffer reiserfs C error done 310 325d 751d 0/28 auto-obsoleted due to no activity on 2024/04/09 15:59
linux-6.1 KASAN: use-after-free Read in leaf_paste_in_buffer origin:upstream missing-backport C done 111 1d13h 553d 0/3 upstream: reported C repro on 2023/06/16 18:50

Sample crash report:
REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
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: out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: out-of-bounds in leaf_paste_in_buffer+0xa27/0xc20 fs/reiserfs/lbalance.c:1043
Read of size 104 at addr ffff88808abeffd8 by task syz-executor181/8098

CPU: 0 PID: 8098 Comm: syz-executor181 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report+0x8f/0xa0 mm/kasan/report.c:412
 memcpy+0x20/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:377 [inline]
 leaf_paste_in_buffer+0xa27/0xc20 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+0x17f6/0x3b60 fs/reiserfs/lbalance.c:726
 leaf_shift_left+0xa0/0x380 fs/reiserfs/lbalance.c:750
 balance_leaf_left fs/reiserfs/do_balan.c:622 [inline]
 balance_leaf+0x2fb8/0xca70 fs/reiserfs/do_balan.c:1420
 do_balance+0x30a/0x760 fs/reiserfs/do_balan.c:1899
 reiserfs_insert_item+0xbf3/0x1010 fs/reiserfs/stree.c:2271
 reiserfs_get_block+0x122b/0x3e40 fs/reiserfs/inode.c:876
 __block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978
 reiserfs_write_begin+0x39f/0xa10 fs/reiserfs/inode.c:2794
 generic_cont_expand_simple+0x106/0x170 fs/buffer.c:2331
 reiserfs_setattr+0xc7c/0x1090 fs/reiserfs/inode.c:3322
 notify_change+0x70b/0xfc0 fs/attr.c:334
 do_truncate+0x134/0x1f0 fs/open.c:63
 do_sys_ftruncate+0x492/0x560 fs/open.c:194
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fcb6bcfba09
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:00007ffe578ff6d8 EFLAGS: 00000246 ORIG_RAX: 000000000000004d
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007fcb6bcfba09
RDX: 00007fcb6bcfba09 RSI: 0000000002007ffb RDI: 0000000000000006
RBP: 0000000000000000 R08: 00007ffe578ff700 R09: 00007ffe578ff700
R10: 00007ffe578ff700 R11: 0000000000000246 R12: 00007ffe578ff6fc
R13: 00007ffe578ff730 R14: 00007ffe578ff710 R15: 0000000000000001

The buggy address belongs to the page:
page:ffffea00022afbc0 count:2 mapcount:0 mapping:ffff8880b1af0a20 index:0x213
flags: 0xfff00000001064(referenced|lru|active|private)
raw: 00fff00000001064 ffffea0002295388 ffffea00022af7c8 ffff8880b1af0a20
raw: 0000000000000213 ffff88808ac4a9d8 00000002ffffffff ffff8880b59f68c0
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8880b59f68c0

Memory state around the buggy address:
 ffff88808abeff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88808abeff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88808abf0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                           ^
 ffff88808abf0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88808abf0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/01 22:10 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: out-of-bounds Read in leaf_paste_in_buffer
2022/11/27 00:32 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: out-of-bounds Read in leaf_paste_in_buffer
2023/01/07 12:08 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2023/01/03 00:33 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2022/12/03 23:16 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2023/01/27 22:15 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: out-of-bounds Read in leaf_paste_in_buffer
2023/02/08 06:59 linux-4.19.y 3f8a27f9e27b 15c3d445 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2023/01/15 15:12 linux-4.19.y 3f8a27f9e27b a63719e7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2023/01/05 08:33 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2022/12/26 09:14 linux-4.19.y 3f8a27f9e27b 9da18ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2022/12/20 19:54 linux-4.19.y 3f8a27f9e27b d3e76707 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2022/12/20 03:10 linux-4.19.y 3f8a27f9e27b c52b2efb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
2022/12/05 08:24 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in leaf_paste_in_buffer
* Struck through repros no longer work on HEAD.