syzbot


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

Status: fixed on 2024/03/20 11:33
Subsystems: jfs
[Documentation on labels]
Reported-by: syzbot+f328fbf8718edb712341@syzkaller.appspotmail.com
Fix commit: 6f861765464f fs: Block writes to mounted block devices
First crash: 457d, last: 96d
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] [jfs?] KASAN: slab-out-of-bounds Read in jfs_readdir 1 (3) 2024/03/07 09:33
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: slab-out-of-bounds Read in jfs_readdir jfs 1 457d 457d 0/1 upstream: reported on 2023/01/12 07:34
linux-4.19 KASAN: slab-out-of-bounds Read in jfs_readdir jfs 2 457d 457d 0/1 upstream: reported on 2023/01/12 07:27
linux-5.15 UBSAN: array-index-out-of-bounds in jfs_readdir origin:upstream C 11 10d 12d 0/3 upstream: reported C repro on 2024/04/01 00:20
linux-6.1 UBSAN: array-index-out-of-bounds in jfs_readdir C 23 12h16m 12d 0/3 upstream: reported C repro on 2024/04/01 00:16
upstream UBSAN: array-index-out-of-bounds in jfs_readdir jfs C inconclusive 24 4d08h 12d 0/26 upstream: reported C repro on 2024/04/01 14:07
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/02/20 15:25 23m retest repro upstream OK log
2024/01/23 05:44 22m retest repro upstream OK log
2024/01/23 05:44 24m retest repro upstream OK log
2024/01/08 01:22 19m retest repro upstream report log
2023/12/12 13:17 14m retest repro upstream report log
2023/11/28 05:47 28m retest repro linux-next OK log
2023/11/14 03:58 18m retest repro upstream report log
2023/11/14 03:58 13m retest repro upstream report log
2023/10/30 00:28 19m retest repro upstream report log
2023/10/03 12:35 18m retest repro upstream report log
Fix bisection attempts (6)
Created Duration User Patch Repo Result
2024/03/03 18:01 9h50m bisect fix upstream job log (1)
2023/08/20 18:46 2h15m bisect fix upstream job log (0) log
2023/06/24 02:09 54m bisect fix upstream job log (0) log
2023/05/06 02:39 24m bisect fix upstream job log (0) log
2023/03/13 16:10 25m bisect fix upstream job log (0) log
2023/02/11 15:07 27m bisect fix upstream job log (0) log

Sample crash report:
loop0: detected capacity change from 0 to 32768
==================================================================
BUG: KASAN: slab-out-of-bounds in jfs_readdir+0x3a89/0x4290 fs/jfs/jfs_dtree.c:2889
Read of size 1 at addr ffff888072df7f75 by task syz-executor114/5106

CPU: 1 PID: 5106 Comm: syz-executor114 Not tainted 6.3.0-rc3-syzkaller-00026-gfff5a5e7f528 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:319
 print_report mm/kasan/report.c:430 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:536
 jfs_readdir+0x3a89/0x4290 fs/jfs/jfs_dtree.c:2889
 iterate_dir+0x1fd/0x6f0 fs/readdir.c:67
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64 fs/readdir.c:354 [inline]
 __x64_sys_getdents64+0x13e/0x2c0 fs/readdir.c:354
 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:0x7f27f3cd89b9
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:00007ffe4cb73bf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 000000000000f031 RCX: 00007f27f3cd89b9
RDX: 00000000000000c5 RSI: 0000000020000200 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00007ffe4cb73c20 R09: 00007ffe4cb73c20
R10: 0000000000005d45 R11: 0000000000000246 R12: 00007ffe4cb73c1c
R13: 00007ffe4cb73c50 R14: 00007ffe4cb73c30 R15: 000000000000001d
 </TASK>

Allocated by task 5106:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 __kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook mm/slab.h:769 [inline]
 slab_alloc_node mm/slub.c:3452 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc_lru+0x20a/0x600 mm/slub.c:3483
 alloc_inode_sb include/linux/fs.h:2686 [inline]
 jfs_alloc_inode+0x27/0x60 fs/jfs/super.c:105
 alloc_inode+0x61/0x230 fs/inode.c:260
 new_inode_pseudo fs/inode.c:1019 [inline]
 new_inode+0x2b/0x280 fs/inode.c:1047
 diReadSpecial+0x53/0x710 fs/jfs/jfs_imap.c:422
 jfs_mount+0x328/0x8b0 fs/jfs/jfs_mount.c:166
 jfs_fill_super+0x5a8/0xd40 fs/jfs/super.c:556
 mount_bdev+0x351/0x410 fs/super.c:1380
 legacy_get_tree+0x109/0x220 fs/fs_context.c:610
 vfs_get_tree+0x8d/0x350 fs/super.c:1510
 do_new_mount fs/namespace.c:3042 [inline]
 path_mount+0x1342/0x1e40 fs/namespace.c:3372
 do_mount fs/namespace.c:3385 [inline]
 __do_sys_mount fs/namespace.c:3594 [inline]
 __se_sys_mount fs/namespace.c:3571 [inline]
 __x64_sys_mount+0x283/0x300 fs/namespace.c:3571
 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

The buggy address belongs to the object at ffff888072df6f00
 which belongs to the cache jfs_ip of size 2240
The buggy address is located 1973 bytes to the right of
 allocated 2240-byte region [ffff888072df6f00, ffff888072df77c0)

The buggy address belongs to the physical page:
page:ffffea0001cb7c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x72df0
head:ffffea0001cb7c00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff888019148c80 dead000000000122 0000000000000000
raw: 0000000000000000 00000000000d000d 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 5104, tgid 5104 (syz-executor114), ts 62255649891, free_ts 9242485986
 prep_new_page mm/page_alloc.c:2552 [inline]
 get_page_from_freelist+0x1190/0x2e20 mm/page_alloc.c:4325
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:5591
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2283
 alloc_slab_page mm/slub.c:1851 [inline]
 allocate_slab+0x25f/0x390 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3193
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc_lru+0x4a8/0x600 mm/slub.c:3483
 alloc_inode_sb include/linux/fs.h:2686 [inline]
 jfs_alloc_inode+0x27/0x60 fs/jfs/super.c:105
 alloc_inode+0x61/0x230 fs/inode.c:260
 new_inode_pseudo fs/inode.c:1019 [inline]
 new_inode+0x2b/0x280 fs/inode.c:1047
 diReadSpecial+0x53/0x710 fs/jfs/jfs_imap.c:422
 jfs_mount+0x328/0x8b0 fs/jfs/jfs_mount.c:166
 jfs_fill_super+0x5a8/0xd40 fs/jfs/super.c:556
 mount_bdev+0x351/0x410 fs/super.c:1380
 legacy_get_tree+0x109/0x220 fs/fs_context.c:610
 vfs_get_tree+0x8d/0x350 fs/super.c:1510
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1453 [inline]
 free_pcp_prepare+0x5d5/0xa50 mm/page_alloc.c:1503
 free_unref_page_prepare mm/page_alloc.c:3387 [inline]
 free_unref_page+0x1d/0x490 mm/page_alloc.c:3482
 free_contig_range+0xb5/0x180 mm/page_alloc.c:9531
 destroy_args+0x6c4/0x920 mm/debug_vm_pgtable.c:1023
 debug_vm_pgtable+0x242a/0x4640 mm/debug_vm_pgtable.c:1403
 do_one_initcall+0x102/0x540 init/main.c:1310
 do_initcall_level init/main.c:1383 [inline]
 do_initcalls init/main.c:1399 [inline]
 do_basic_setup init/main.c:1418 [inline]
 kernel_init_freeable+0x696/0xc00 init/main.c:1638
 kernel_init+0x1e/0x2c0 init/main.c:1526
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffff888072df7e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888072df7e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888072df7f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                             ^
 ffff888072df7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888072df8000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (17):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/03/23 09:12 upstream fff5a5e7f528 f94b4a29 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in jfs_readdir
2023/01/12 12:31 upstream e8f60cd7db24 96166539 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in jfs_readdir
2023/05/14 23:16 linux-next e922ba281a8d 2b9ba477 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in jfs_readdir
2023/09/18 19:55 upstream ce9ecca0238b 0b6a67ac .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root UBSAN: array-index-out-of-bounds in jfs_readdir
2023/07/15 09:01 upstream 2772d7df3c93 35d9ecc5 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in jfs_readdir
2023/01/12 13:45 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in jfs_readdir
2023/01/12 12:14 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-out-of-bounds Read in jfs_readdir
2023/01/12 07:32 upstream e8f60cd7db24 96166539 .config console log report info ci-qemu-upstream KASAN: slab-out-of-bounds Read in jfs_readdir
2023/01/12 07:32 upstream e8f60cd7db24 96166539 .config console log report info ci-qemu-upstream KASAN: slab-out-of-bounds Read in jfs_readdir
2023/01/12 07:28 upstream e8f60cd7db24 96166539 .config console log report info ci-qemu-upstream-386 KASAN: slab-out-of-bounds Read in jfs_readdir
2023/10/11 20:59 upstream 1c8b86a3799f 83165b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in jfs_readdir
2023/04/05 16:37 upstream 76f598ba7d8e 8b834965 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in jfs_readdir
2023/03/26 15:07 upstream da8e7da11e4b fbf0499a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in jfs_readdir
2023/01/12 13:29 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in jfs_readdir
2023/01/12 13:28 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in jfs_readdir
2023/01/12 07:34 upstream 7dd4b804e080 96166539 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs UBSAN: array-index-out-of-bounds in jfs_readdir
2023/10/03 19:28 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 2e530aeb342b 65faba36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in jfs_readdir
* Struck through repros no longer work on HEAD.