syzbot


KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec

Status: auto-obsoleted due to no activity on 2024/07/18 14:03
Subsystems: jffs2
[Documentation on labels]
Reported-by: syzbot+d7c218ea1def103f6bcd@syzkaller.appspotmail.com
First crash: 229d, last: 207d
Cause bisection: failed (error log, bisect log)
  
Fix bisection: fixed by (bisect log) :
commit c6854e5a267c28300ff045480b5a7ee7f6f1d913
Author: Ilya Denisyev <dev@elkcl.ru>
Date: Fri Apr 12 15:53:54 2024 +0000

  jffs2: prevent xattr node from overflowing the eraseblock

  
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] [jffs2?] KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec 0 (2) 2024/07/04 14:03
[syzbot] Monthly jffs2 report (Apr 2024) 0 (1) 2024/04/13 10:29
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/07/08 13:28 31m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci OK log
2024/04/28 18:18 20m retest repro upstream report log
2024/04/28 18:18 18m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in jffs2_sum_add_kvec+0x125a/0x15d0 fs/jffs2/summary.c:261
Read of size 4 at addr ffff88807afc4cbc by task syz-executor218/5070

CPU: 1 PID: 5070 Comm: syz-executor218 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:488
 kasan_report+0xd9/0x110 mm/kasan/report.c:601
 jffs2_sum_add_kvec+0x125a/0x15d0 fs/jffs2/summary.c:261
 jffs2_flash_direct_writev+0xa8/0xd0 fs/jffs2/writev.c:22
 jffs2_flash_writev+0x9d5/0xf00 fs/jffs2/wbuf.c:805
 save_xattr_datum+0x44b/0x780 fs/jffs2/xattr.c:317
 create_xattr_datum fs/jffs2/xattr.c:387 [inline]
 do_jffs2_setxattr+0xa54/0x1640 fs/jffs2/xattr.c:1173
 __vfs_setxattr+0x173/0x1e0 fs/xattr.c:200
 __vfs_setxattr_noperm+0x127/0x5e0 fs/xattr.c:234
 __vfs_setxattr_locked+0x182/0x260 fs/xattr.c:295
 vfs_setxattr+0x146/0x350 fs/xattr.c:321
 do_setxattr+0x146/0x170 fs/xattr.c:629
 setxattr+0x15d/0x180 fs/xattr.c:652
 path_setxattr+0x179/0x1e0 fs/xattr.c:671
 __do_sys_setxattr fs/xattr.c:687 [inline]
 __se_sys_setxattr fs/xattr.c:683 [inline]
 __x64_sys_setxattr+0xc4/0x160 fs/xattr.c:683
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7fd702c0af89
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 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:00007ffd49084988 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007fd702c0af89
RDX: 0000000020000900 RSI: 0000000020000100 RDI: 00000000200000c0
RBP: 00000000000f4240 R08: 0000000000000000 R09: 000055558980e378
R10: 000000000000feeb R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd490849c0 R14: 00007ffd490849ac R15: 00007fd702c5403b
 </TASK>

Allocated by task 5067:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slub.c:3966 [inline]
 __kmalloc+0x1f9/0x440 mm/slub.c:3979
 kmalloc include/linux/slab.h:632 [inline]
 kzalloc include/linux/slab.h:749 [inline]
 jffs2_do_mount_fs+0x84b/0x2460 fs/jffs2/build.c:387
 jffs2_do_fill_super+0x3d4/0xa60 fs/jffs2/fs.c:573
 jffs2_fill_super+0x283/0x370 fs/jffs2/super.c:289
 mtd_get_sb+0x2ce/0x490 drivers/mtd/mtdsuper.c:57
 mtd_get_sb_by_nr drivers/mtd/mtdsuper.c:88 [inline]
 get_tree_mtd+0x6ce/0x860 drivers/mtd/mtdsuper.c:141
 vfs_get_tree+0x8f/0x380 fs/super.c:1779
 do_new_mount fs/namespace.c:3352 [inline]
 path_mount+0x14e6/0x1f20 fs/namespace.c:3679
 do_mount fs/namespace.c:3692 [inline]
 __do_sys_mount fs/namespace.c:3898 [inline]
 __se_sys_mount fs/namespace.c:3875 [inline]
 __x64_sys_mount+0x297/0x320 fs/namespace.c:3875
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75

The buggy address belongs to the object at ffff88807afc4000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 956 bytes to the right of
 allocated 2304-byte region [ffff88807afc4000, ffff88807afc4900)

The buggy address belongs to the physical page:
page:ffffea0001ebf000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7afc0
head:ffffea0001ebf000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888015042140 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5067, tgid 5067 (syz-executor218), ts 77397646236, free_ts 77385475543
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1533
 prep_new_page mm/page_alloc.c:1540 [inline]
 get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3311
 __alloc_pages+0x22b/0x2410 mm/page_alloc.c:4569
 __alloc_pages_node include/linux/gfp.h:238 [inline]
 alloc_pages_node include/linux/gfp.h:261 [inline]
 alloc_slab_page mm/slub.c:2175 [inline]
 allocate_slab mm/slub.c:2338 [inline]
 new_slab+0xcc/0x3a0 mm/slub.c:2391
 ___slab_alloc+0x66d/0x1790 mm/slub.c:3525
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610
 __slab_alloc_node mm/slub.c:3663 [inline]
 slab_alloc_node mm/slub.c:3835 [inline]
 kmalloc_trace+0x2fb/0x330 mm/slub.c:3992
 kmalloc include/linux/slab.h:628 [inline]
 kzalloc include/linux/slab.h:749 [inline]
 jffs2_init_fs_context+0x3f/0xd0 fs/jffs2/super.c:313
 alloc_fs_context+0x54a/0x9c0 fs/fs_context.c:318
 do_new_mount fs/namespace.c:3331 [inline]
 path_mount+0xb08/0x1f20 fs/namespace.c:3679
 do_mount fs/namespace.c:3692 [inline]
 __do_sys_mount fs/namespace.c:3898 [inline]
 __se_sys_mount fs/namespace.c:3875 [inline]
 __x64_sys_mount+0x297/0x320 fs/namespace.c:3875
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
page last free pid 784 tgid 784 stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1140 [inline]
 free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2346
 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2486
 __folio_put+0xeb/0x110 mm/swap.c:127
 folio_put include/linux/mm.h:1494 [inline]
 put_page+0x21e/0x280 include/linux/mm.h:1563
 page_to_skb+0x848/0xb00 drivers/net/virtio_net.c:621
 receive_mergeable drivers/net/virtio_net.c:1683 [inline]
 receive_buf+0x118d/0x51f0 drivers/net/virtio_net.c:1804
 virtnet_receive drivers/net/virtio_net.c:2110 [inline]
 virtnet_poll+0xa0b/0x1840 drivers/net/virtio_net.c:2203
 __napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:6632
 napi_poll net/core/dev.c:6701 [inline]
 net_rx_action+0x9ad/0xf10 net/core/dev.c:6813
 __do_softirq+0x218/0x8de kernel/softirq.c:554

Memory state around the buggy address:
 ffff88807afc4b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807afc4c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807afc4c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff88807afc4d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807afc4d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/14 10:14 upstream fe46a7dd189e c8349e48 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/06 05:04 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 18ea8213 .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/07 22:56 upstream fe46a7dd189e ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/13 20:57 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci b5d2afe8745b c8349e48 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/13 20:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci b5d2afe8745b c8349e48 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/07 03:07 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/06 17:24 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/06 10:29 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/06 04:27 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 18ea8213 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
2024/04/06 04:27 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 18ea8213 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in jffs2_sum_add_kvec
* Struck through repros no longer work on HEAD.