syzbot


KASAN: use-after-free Read in jfs_lazycommit

Status: upstream: reported C repro on 2022/10/01 13:43
Labels: jfs (incorrect?)
Reported-by: syzbot+885a4f3281b8d99c48d8@syzkaller.appspotmail.com
First crash: 249d, last: 1d14h

Cause bisection: failed (error log, bisect log)
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] KASAN: use-after-free Read in jfs_lazycommit 0 (2) 2022/10/12 05:33
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in jfs_lazycommit jfs C error 5 115d 232d 0/1 upstream: reported C repro on 2022/10/13 08:33
linux-6.1 KASAN: use-after-free Read in jfs_lazycommit origin:upstream C 4 5d14h 25d 0/3 upstream: reported C repro on 2023/05/07 23:35
linux-5.15 KASAN: use-after-free Read in jfs_lazycommit origin:upstream C 6 19d 27d 0/3 upstream: reported C repro on 2023/05/06 12:04
linux-4.14 KASAN: use-after-free Read in jfs_lazycommit jfs C 6 92d 234d 0/1 upstream: reported C repro on 2022/10/11 20:09
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/04/03 16:43 56m bisect fix upstream job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in jfs_lazycommit+0x7e4/0xb80 fs/jfs/jfs_txnmgr.c:2730
Read of size 4 at addr ffff888021aeca94 by task jfsCommit/121

CPU: 1 PID: 121 Comm: jfsCommit Not tainted 6.1.0-rc4-syzkaller-00159-g4bbf3422df78 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106
 print_address_description+0x74/0x340 mm/kasan/report.c:284
 print_report+0x107/0x1f0 mm/kasan/report.c:395
 kasan_report+0xcd/0x100 mm/kasan/report.c:495
 jfs_lazycommit+0x7e4/0xb80 fs/jfs/jfs_txnmgr.c:2730
 kthread+0x266/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 </TASK>

Allocated by task 4240:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x3d/0x60 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:380
 kmalloc include/linux/slab.h:553 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 jfs_fill_super+0xfb/0xc50 fs/jfs/super.c:495
 mount_bdev+0x26c/0x3a0 fs/super.c:1401
 legacy_get_tree+0xea/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1531
 do_new_mount+0x289/0xad0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 3653:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x3d/0x60 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:511
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1750
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x71/0x110 mm/slub.c:3674
 generic_shutdown_super+0x130/0x310 fs/super.c:492
 kill_block_super+0x79/0xd0 fs/super.c:1428
 deactivate_locked_super+0xa7/0xf0 fs/super.c:332
 cleanup_mnt+0x494/0x520 fs/namespace.c:1186
 task_work_run+0x243/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203
 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
 syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888021aeca00
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 148 bytes inside of
 256-byte region [ffff888021aeca00, ffff888021aecb00)

The buggy address belongs to the physical page:
page:ffffea000086bb00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21aec
head:ffffea000086bb00 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888012041b40
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3793, tgid 3790 (syz-executor239), ts 844787750126, free_ts 844712741228
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x742/0x7c0 mm/page_alloc.c:4288
 __alloc_pages+0x259/0x560 mm/page_alloc.c:5555
 alloc_slab_page+0x70/0xf0 mm/slub.c:1794
 allocate_slab+0x5e/0x4b0 mm/slub.c:1939
 new_slab mm/slub.c:1992 [inline]
 ___slab_alloc+0x782/0xe20 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x252/0x310 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc+0x9e/0x1a0 mm/slab_common.c:968
 kmalloc_array include/linux/slab.h:605 [inline]
 kcalloc include/linux/slab.h:636 [inline]
 __list_lru_init+0xa0/0x5f0 mm/list_lru.c:571
 alloc_super+0x7a7/0x920 fs/super.c:272
 sget+0x20e/0x560 fs/super.c:643
 mount_bdev+0xe8/0x3a0 fs/super.c:1372
 legacy_get_tree+0xea/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1531
 do_new_mount+0x289/0xad0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare+0x80c/0x8f0 mm/page_alloc.c:1509
 free_unref_page_prepare mm/page_alloc.c:3387 [inline]
 free_unref_page+0x7d/0x5f0 mm/page_alloc.c:3483
 free_slab mm/slub.c:2031 [inline]
 discard_slab mm/slub.c:2037 [inline]
 __unfreeze_partials+0x1ab/0x200 mm/slub.c:2586
 put_cpu_partial+0x106/0x170 mm/slub.c:2662
 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:302
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slab.h:737 [inline]
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x1cc/0x300 mm/slub.c:3422
 insert_revoke_hash+0x29/0x1f0 fs/jbd2/revoke.c:145
 __ext4_forget+0x290/0x740 fs/ext4/ext4_jbd2.c:302
 ext4_free_blocks+0x94f/0x2810 fs/ext4/mballoc.c:6175
 ext4_convert_unwritten_extents_endio fs/ext4/extents.c:3770 [inline]
 ext4_ext_handle_unwritten_extents fs/ext4/extents.c:3898 [inline]
 ext4_ext_map_blocks+0x3680/0x6880 fs/ext4/extents.c:4168
 ext4_map_blocks+0xa49/0x1cc0 fs/ext4/inode.c:645
 ext4_convert_unwritten_extents+0x2ed/0x700 fs/ext4/extents.c:4812
 ext4_dio_write_end_io+0xbe/0x160 fs/ext4/file.c:396
 iomap_dio_complete+0x160/0x740 fs/iomap/direct-io.c:89

Memory state around the buggy address:
 ffff888021aec980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888021aeca00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888021aeca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff888021aecb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888021aecb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (24):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2022/11/11 11:47 upstream 4bbf3422df78 f42ee5d8 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2022/10/12 05:32 upstream 493ffd6605b2 02b6492e .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2023/05/07 17:49 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 14f8db1c0f9a 90c93c40 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in jfs_lazycommit
2023/02/12 04:26 upstream d12aca5c0cee 93e26d60 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2023/02/06 13:36 upstream d2d11f342b17 0a9c11b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2023/01/20 23:08 upstream edc00350d205 7374c4e5 .config console log report info ci-qemu-upstream KASAN: use-after-free Read in jfs_lazycommit
2022/12/21 09:11 upstream 6feb57c2fd7c d3e76707 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2022/12/14 10:21 upstream e2ca6ba6ba01 f6511626 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: use-after-free Read in jfs_lazycommit
2022/11/24 10:47 upstream 4312098baf37 ff68ff8f .config console log report info ci-qemu-upstream KASAN: use-after-free Read in jfs_lazycommit
2022/11/01 07:29 upstream b229b6ca5abb a1d8560a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2022/10/14 11:09 upstream 493ffd6605b2 4954e4b2 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2022/10/11 05:58 upstream 493ffd6605b2 5bcf0c31 .config console log report info [disk image] [vmlinux] ci2-upstream-fs KASAN: use-after-free Read in jfs_lazycommit
2022/09/26 22:13 upstream 3800a713b607 10323ddf .config console log report info ci-qemu-upstream KASAN: use-after-free Read in jfs_lazycommit
2023/02/14 02:55 upstream b408817d4884 93ae7e0a .config console log report info ci-qemu-upstream-386 KASAN: use-after-free Read in jfs_lazycommit
2022/12/13 18:52 upstream 764822972d64 e660de91 .config console log report info ci-qemu-upstream-386 KASAN: use-after-free Read in jfs_lazycommit
2023/06/01 08:27 upstream 929ed21dfdb6 babc4389 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in jfs_lazycommit
2023/05/19 16:58 upstream 2d1bcbc6cd70 96689200 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs general protection fault in jfs_lazycommit
2023/04/21 21:15 upstream 2af3e53a4dc0 2b32bd34 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in jfs_lazycommit
2023/04/06 20:13 upstream f2afccfefe7b 08707520 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in jfs_lazycommit
2023/03/04 16:42 upstream 0988a0ea7919 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in jfs_lazycommit
2023/02/26 19:09 upstream 2fcd07b7ccd5 630c6bc9 .config console log report info ci-qemu-upstream KASAN: slab-use-after-free Read in jfs_lazycommit
2023/02/26 10:50 upstream 2fcd07b7ccd5 ee50e71c .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in jfs_lazycommit
2023/05/13 19:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 14f8db1c0f9a 2b9ba477 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in jfs_lazycommit
2023/05/01 04:16 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 14f8db1c0f9a 62df2017 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in jfs_lazycommit
* Struck through repros no longer work on HEAD.