syzbot


KASAN: invalid-free in diUnmount

Status: upstream: reported C repro on 2023/03/12 22:37
Bug presence: origin:lts-only
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+e8f9034a130a66a2b351@syzkaller.appspotmail.com
First crash: 458d, last: 271d
Fix commit to backport (bisect log) :
tree: upstream
commit 6e2bda2c192d0244b5a78b787ef20aa10cb319b7
Author: Liu Shixin via Jfs-discussion <jfs-discussion@lists.sourceforge.net>
Date: Thu Dec 1 12:46:28 2022 +0000

  jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount

[report pending]
  
Discussions (1)
Title Replies (including bot) Last reply
[PATCH] jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount 6 (6) 2023/07/18 19:46
Bug presence (2)
Date Name Commit Repro Result
2023/09/15 linux-6.1.y (ToT) 09045dae0d90 C [report] KASAN: invalid-free in diUnmount
2023/09/15 upstream (ToT) 4eb2bd24756e C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: invalid-free in diUnmount jfs C error 98 264d 561d 28/28 closed as dup on 2023/07/18 16:07
linux-5.15 KASAN: invalid-free in diUnmount origin:upstream missing-backport C error 1 269d 360d 0/3 upstream: reported C repro on 2023/06/18 11:33
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/10/07 00:03 4h50m fix candidate upstream job log (1)

Sample crash report:
==================================================================
BUG: KASAN: double-free in diUnmount+0xef/0x100 fs/jfs/jfs_imap.c:195
Free of addr ffff888022030000 by task syz-executor425/3546

CPU: 1 PID: 3546 Comm: syz-executor425 Not tainted 6.1.53-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report_invalid_free+0x10c/0x130 mm/kasan/report.c:460
 ____kasan_slab_free+0xfb/0x120
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
 diUnmount+0xef/0x100 fs/jfs/jfs_imap.c:195
 jfs_umount+0x109/0x370 fs/jfs/jfs_umount.c:63
 jfs_put_super+0x86/0x180 fs/jfs/super.c:194
 generic_shutdown_super+0x130/0x340 fs/super.c:501
 kill_block_super+0x7a/0xe0 fs/super.c:1459
 deactivate_locked_super+0xa0/0x110 fs/super.c:332
 cleanup_mnt+0x490/0x520 fs/namespace.c:1186
 task_work_run+0x246/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fbd87b85507
Code: 07 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffc7a3b6088 EFLAGS: 00000206 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007fbd87b85507
RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffc7a3b6140
RBP: 00007ffc7a3b6140 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000206 R12: 00007ffc7a3b71c0
R13: 0000555556de96c0 R14: 431bde82d7b634db R15: 00007ffc7a3b71e0
 </TASK>

Allocated by task 3546:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc+0xb2/0x230 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 tomoyo_realpath_from_path+0xcb/0x5d0 security/tomoyo/realpath.c:251
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x22c/0x490 security/tomoyo/file.c:771
 security_file_open+0x5f/0xa0 security/security.c:1663
 do_dentry_open+0x308/0x10f0 fs/open.c:869
 do_open fs/namei.c:3557 [inline]
 path_openat+0x2644/0x2e60 fs/namei.c:3714
 do_filp_open+0x230/0x480 fs/namei.c:3741
 do_sys_openat2+0x13b/0x500 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1345
 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 3546:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____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 mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
 tomoyo_realpath_from_path+0x59f/0x5d0 security/tomoyo/realpath.c:286
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x22c/0x490 security/tomoyo/file.c:771
 security_file_open+0x5f/0xa0 security/security.c:1663
 do_dentry_open+0x308/0x10f0 fs/open.c:869
 do_open fs/namei.c:3557 [inline]
 path_openat+0x2644/0x2e60 fs/namei.c:3714
 do_filp_open+0x230/0x480 fs/namei.c:3741
 do_sys_openat2+0x13b/0x500 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1345
 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

The buggy address belongs to the object at ffff888022030000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 0 bytes inside of
 4096-byte region [ffff888022030000, ffff888022031000)

The buggy address belongs to the physical page:
page:ffffea0000880c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22030
head:ffffea0000880c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888012442140
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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3546, tgid 3546 (syz-executor425), ts 71858161136, free_ts 71850423265
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xa71/0x1080 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc+0xa1/0x230 mm/slab_common.c:968
 kmalloc include/linux/slab.h:558 [inline]
 tomoyo_realpath_from_path+0xcb/0x5d0 security/tomoyo/realpath.c:251
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x22c/0x490 security/tomoyo/file.c:771
 security_file_open+0x5f/0xa0 security/security.c:1663
 do_dentry_open+0x308/0x10f0 fs/open.c:869
 do_open fs/namei.c:3557 [inline]
 path_openat+0x2644/0x2e60 fs/namei.c:3714
 do_filp_open+0x230/0x480 fs/namei.c:3741
 do_sys_openat2+0x13b/0x500 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1345
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1460 [inline]
 free_pcp_prepare mm/page_alloc.c:1510 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
 free_unref_page+0x98/0x570 mm/page_alloc.c:3484
 free_large_kmalloc+0xfb/0x190 mm/slab_common.c:932
 diMount+0x653/0x870 fs/jfs/jfs_imap.c:115
 jfs_mount_rw+0x307/0x640 fs/jfs/jfs_mount.c:238
 jfs_remount+0x3cd/0x6a0 fs/jfs/super.c:454
 reconfigure_super+0x43a/0x870 fs/super.c:966
 do_remount fs/namespace.c:2702 [inline]
 path_mount+0xe69/0x1090 fs/namespace.c:3362
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d5/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

Memory state around the buggy address:
 ffff88802202ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802202ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888022030000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888022030080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888022030100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/15 20:08 linux-6.1.y 09045dae0d90 0b6a67ac .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: invalid-free in diUnmount
2023/07/23 05:05 linux-6.1.y a456e1743881 27cbe77f .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: invalid-free in diUnmount
2023/04/04 17:26 linux-6.1.y 3b29299e5f60 928dd177 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: invalid-free in diUnmount
2023/03/12 22:37 linux-6.1.y 1cc3fcf63192 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: invalid-free in diUnmount
* Struck through repros no longer work on HEAD.