syzbot


KASAN: use-after-free Read in jbd2_journal_get_write_access

Status: upstream: reported C repro on 2023/12/15 22:55
Bug presence: origin:lts
[Documentation on labels]
Reported-by: syzbot+df86e09e8f1228f19f8e@syzkaller.appspotmail.com
First crash: 343d, last: 84d
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2023/12/16 lts (merge base) 2a910f4af54d C [report] KASAN: use-after-free Read in jbd2_journal_get_write_access
2023/12/15 upstream (ToT) 3bd7d7488169 C Didn't crash
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in jbd2_journal_get_write_access origin:lts-only C inconclusive 8 52d 421d 0/3 upstream: reported C repro on 2023/09/28 11:26
Last patch testing requests (1)
Created Duration User Patch Repo Result
2023/12/29 22:55 5m retest repro android13-5.15-lts report log
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2024/10/14 23:07 0m bisect fix android13-5.15-lts error job log
2024/08/31 05:39 2h37m bisect fix android13-5.15-lts OK (0) job log log
2024/07/25 15:51 2h14m bisect fix android13-5.15-lts OK (0) job log log
2024/06/09 15:55 1h23m bisect fix android13-5.15-lts OK (0) job log log
2024/05/10 08:05 1h03m bisect fix android13-5.15-lts OK (0) job log log
2024/04/06 15:19 3h44m bisect fix android13-5.15-lts OK (0) job log log
2024/03/06 20:46 1h21m bisect fix android13-5.15-lts OK (0) job log log
2024/01/29 09:13 1h07m bisect fix android13-5.15-lts OK (0) job log log

Sample crash report:
RBP: 0000000000000002 R08: 00007ffca71334c6 R09: 00007ffca719a198
R10: 0000000000000002 R11: 0000000000000246 R12: 00007ffca713374c
R13: 00007ffca7133790 R14: 00007ffca7133770 R15: 0000000000000012
 </TASK>
==================================================================
BUG: KASAN: use-after-free in is_handle_aborted include/linux/jbd2.h:1694 [inline]
BUG: KASAN: use-after-free in jbd2_journal_get_write_access+0x2cb/0x2d0 fs/jbd2/transaction.c:1241
Read of size 4 at addr ffff88811b660acc by task syz-executor392/440

CPU: 0 PID: 440 Comm: syz-executor392 Not tainted 5.15.139-syzkaller-00529-g05ef4ccb5774 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 is_handle_aborted include/linux/jbd2.h:1694 [inline]
 jbd2_journal_get_write_access+0x2cb/0x2d0 fs/jbd2/transaction.c:1241
 __ext4_journal_get_write_access+0x244/0x690 fs/ext4/ext4_jbd2.c:235
 ext4_reserve_inode_write+0x2bd/0x3d0 fs/ext4/inode.c:5813
 __ext4_mark_inode_dirty+0x129/0x7a0 fs/ext4/inode.c:5987
 ext4_symlink+0xa2c/0xed0 fs/ext4/namei.c:3463
 vfs_symlink+0x29f/0x480 fs/namei.c:4358
 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4387
 __do_sys_symlink fs/namei.c:4409 [inline]
 __se_sys_symlink fs/namei.c:4407 [inline]
 __x64_sys_symlink+0x7e/0x90 fs/namei.c:4407
 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+0x61/0xcb
RIP: 0033:0x7f3575952459
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:00007ffca7133728 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 00007ffca7133750 RCX: 00007f3575952459
RDX: 00007f3575951520 RSI: 0000000020000180 RDI: 0000000020000140
RBP: 0000000000000002 R08: 00007ffca71334c6 R09: 00007ffca719a198
R10: 0000000000000002 R11: 0000000000000246 R12: 00007ffca713374c
R13: 00007ffca7133790 R14: 00007ffca7133770 R15: 0000000000000012
 </TASK>

Allocated by task 440:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 __kasan_slab_alloc+0xb1/0xe0 mm/kasan/common.c:466
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3240 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc+0xf5/0x200 mm/slub.c:3253
 kmem_cache_zalloc include/linux/slab.h:723 [inline]
 jbd2_alloc_handle include/linux/jbd2.h:1597 [inline]
 new_handle fs/jbd2/transaction.c:477 [inline]
 jbd2__journal_start+0x150/0x710 fs/jbd2/transaction.c:504
 __ext4_journal_start_sb+0xfa/0x2c0 fs/ext4/ext4_jbd2.c:105
 __ext4_new_inode+0x135d/0x40a0 fs/ext4/ialloc.c:1080
 ext4_symlink+0x4c3/0xed0 fs/ext4/namei.c:3382
 vfs_symlink+0x29f/0x480 fs/namei.c:4358
 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4387
 __do_sys_symlink fs/namei.c:4409 [inline]
 __se_sys_symlink fs/namei.c:4407 [inline]
 __x64_sys_symlink+0x7e/0x90 fs/namei.c:4407
 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+0x61/0xcb

Freed by task 440:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3519 [inline]
 kmem_cache_free+0x116/0x2e0 mm/slub.c:3535
 jbd2_free_handle include/linux/jbd2.h:1602 [inline]
 jbd2_journal_stop+0x82c/0xc70 fs/jbd2/transaction.c:1964
 __ext4_journal_stop+0x111/0x1c0 fs/ext4/ext4_jbd2.c:127
 ext4_symlink+0x5fe/0xed0 fs/ext4/namei.c:3461
 vfs_symlink+0x29f/0x480 fs/namei.c:4358
 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4387
 __do_sys_symlink fs/namei.c:4409 [inline]
 __se_sys_symlink fs/namei.c:4407 [inline]
 __x64_sys_symlink+0x7e/0x90 fs/namei.c:4407
 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+0x61/0xcb

The buggy address belongs to the object at ffff88811b660aa8
 which belongs to the cache jbd2_journal_handle of size 56
The buggy address is located 36 bytes inside of
 56-byte region [ffff88811b660aa8, ffff88811b660ae0)
The buggy address belongs to the page:
page:ffffea00046d9800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11b660
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 dead000000000122 ffff888104baf980
raw: 0000000000000000 00000000802e002e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x12c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_RECLAIMABLE), pid 437, ts 58960885809, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2604
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2610
 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4484
 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5776
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0x9a/0x4e0 mm/slub.c:1995
 ___slab_alloc+0x39e/0x830 mm/slub.c:3028
 __slab_alloc+0x4a/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc+0x134/0x200 mm/slub.c:3253
 kmem_cache_zalloc include/linux/slab.h:723 [inline]
 jbd2_alloc_handle include/linux/jbd2.h:1597 [inline]
 new_handle fs/jbd2/transaction.c:477 [inline]
 jbd2__journal_start+0x150/0x710 fs/jbd2/transaction.c:504
 __ext4_journal_start_sb+0xfa/0x2c0 fs/ext4/ext4_jbd2.c:105
 __ext4_new_inode+0x135d/0x40a0 fs/ext4/ialloc.c:1080
 ext4_mkdir+0x421/0xce0 fs/ext4/namei.c:3017
 vfs_mkdir+0x3f6/0x610 fs/namei.c:3994
 do_mkdirat+0x1eb/0x450 fs/namei.c:4019
 __do_sys_mkdir fs/namei.c:4039 [inline]
 __se_sys_mkdir fs/namei.c:4037 [inline]
 __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4037
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811b660980: fc fc fc fc fa fb fb fb fb fb fb fc fc fc fc fa
 ffff88811b660a00: fb fb fb fb fb fb fc fc fc fc fa fb fb fb fb fb
>ffff88811b660a80: fb fc fc fc fc fa fb fb fb fb fb fb fc fc fc fc
                                              ^
 ffff88811b660b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811b660b80: fc fc fc fc fc fc fa fb fb fb fb fb fb fc fc fc
==================================================================
------------[ cut here ]------------
kernel BUG at fs/jbd2/transaction.c:1102!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 440 Comm: syz-executor392 Tainted: G    B             5.15.139-syzkaller-00529-g05ef4ccb5774 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
RIP: 0010:do_get_write_access+0xd96/0xdb0 fs/jbd2/transaction.c:1102
Code: 4d c8 80 e1 07 80 c1 03 38 c1 0f 8c f0 fe ff ff 48 8b 7d c8 e8 1b 83 b7 ff e9 e2 fe ff ff e8 d1 7d 75 ff 0f 0b e8 ca 7d 75 ff <0f> 0b e8 c3 7d 75 ff 0f 0b e8 bc 7d 75 ff 0f 0b 66 2e 0f 1f 84 00
RSP: 0018:ffffc90000e67828 EFLAGS: 00010293

RAX: ffffffff81fa8366 RBX: ffff88810bd42c80 RCX: ffff888117b213c0
RDX: 0000000000000000 RSI: 0000000000000292 RDI: ffff88810bae30a0
RBP: ffffc90000e678f0 R08: dffffc0000000000 R09: ffffed10236a9312
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff88811b551238 R14: 1ffff110236a9311 R15: ffff88811b549888
FS:  0000555555a60380(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f35759b19a4 CR3: 000000011fc20000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 jbd2_journal_get_write_access+0x195/0x2d0 fs/jbd2/transaction.c:1251
 __ext4_journal_get_write_access+0x244/0x690 fs/ext4/ext4_jbd2.c:235
 ext4_reserve_inode_write+0x2bd/0x3d0 fs/ext4/inode.c:5813
 __ext4_mark_inode_dirty+0x129/0x7a0 fs/ext4/inode.c:5987
 ext4_symlink+0xa2c/0xed0 fs/ext4/namei.c:3463
 vfs_symlink+0x29f/0x480 fs/namei.c:4358
 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4387
 __do_sys_symlink fs/namei.c:4409 [inline]
 __se_sys_symlink fs/namei.c:4407 [inline]
 __x64_sys_symlink+0x7e/0x90 fs/namei.c:4407
 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+0x61/0xcb
RIP: 0033:0x7f3575952459
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:00007ffca7133728 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 00007ffca7133750 RCX: 00007f3575952459
RDX: 00007f3575951520 RSI: 0000000020000180 RDI: 0000000020000140
RBP: 0000000000000002 R08: 00007ffca71334c6 R09: 00007ffca719a198
R10: 0000000000000002 R11: 0000000000000246 R12: 00007ffca713374c
R13: 00007ffca7133790 R14: 00007ffca7133770 R15: 0000000000000012
 </TASK>
Modules linked in:
---[ end trace f2bd4c4fff801a90 ]---
RIP: 0010:do_get_write_access+0xd96/0xdb0 fs/jbd2/transaction.c:1102
Code: 4d c8 80 e1 07 80 c1 03 38 c1 0f 8c f0 fe ff ff 48 8b 7d c8 e8 1b 83 b7 ff e9 e2 fe ff ff e8 d1 7d 75 ff 0f 0b e8 ca 7d 75 ff <0f> 0b e8 c3 7d 75 ff 0f 0b e8 bc 7d 75 ff 0f 0b 66 2e 0f 1f 84 00
RSP: 0018:ffffc90000e67828 EFLAGS: 00010293
RAX: ffffffff81fa8366 RBX: ffff88810bd42c80 RCX: ffff888117b213c0
RDX: 0000000000000000 RSI: 0000000000000292 RDI: ffff88810bae30a0
RBP: ffffc90000e678f0 R08: dffffc0000000000 R09: ffffed10236a9312
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff88811b551238 R14: 1ffff110236a9311 R15: ffff88811b549888
FS:  0000555555a60380(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f35759b19a4 CR3: 000000011fc20000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/12/15 22:55 android13-5.15-lts 05ef4ccb5774 3222d10c .config strace log report syz C [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in jbd2_journal_get_write_access
* Struck through repros no longer work on HEAD.