[Android 5.15] [ext4?] KASAN: use-after-free Read in ext4_group_desc_csum

13 views
Skip to first unread message

syzbot

unread,
Feb 13, 2023, 3:15:48 PM2/13/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 5020746bff95 Merge 5.15.92 into android13-5.15-lts
git tree: android13-5.15-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=1203c877480000
kernel config: https://syzkaller.appspot.com/x/.config?x=add9b2141f589f20
dashboard link: https://syzkaller.appspot.com/bug?extid=fc51227e7100c9294894
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=128a7cc7480000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1789b268c80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/47bdc3b3c596/disk-5020746b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b8afcc886efe/vmlinux-5020746b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5ccec476f7a2/bzImage-5020746b.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/8f5c5969d6ed/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fc5122...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in crc16+0x216/0x2a0 lib/crc16.c:58
Read of size 1 at addr ffff888120092000 by task syz-executor170/23047

CPU: 0 PID: 23047 Comm: syz-executor170 Not tainted 5.15.92-syzkaller-03013-g5020746bff95 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/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_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
crc16+0x216/0x2a0 lib/crc16.c:58
ext4_group_desc_csum+0x882/0xb90 fs/ext4/super.c:2840
ext4_group_desc_csum_set+0x1d8/0x270 fs/ext4/super.c:2863
ext4_free_blocks+0x1c48/0x2ce0 fs/ext4/mballoc.c:6113
ext4_remove_blocks fs/ext4/extents.c:2525 [inline]
ext4_ext_rm_leaf fs/ext4/extents.c:2709 [inline]
ext4_ext_remove_space+0x29b2/0x4a60 fs/ext4/extents.c:2957
ext4_ext_truncate+0x19a/0x240 fs/ext4/extents.c:4419
ext4_truncate+0x96c/0xfa0 fs/ext4/inode.c:4276
ext4_evict_inode+0xcee/0x14e0 fs/ext4/inode.c:290
evict+0x2a3/0x630 fs/inode.c:587
iput_final fs/inode.c:1663 [inline]
iput+0x63b/0x7e0 fs/inode.c:1689
do_unlinkat+0x4db/0x910 fs/namei.c:4228
__do_sys_unlink fs/namei.c:4269 [inline]
__se_sys_unlink fs/namei.c:4267 [inline]
__x64_sys_unlink+0x49/0x50 fs/namei.c:4267
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:0x7f34e83ddbd9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f34e83892f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 00007f34e84637a0 RCX: 00007f34e83ddbd9
RDX: 00007f34e83ddbd9 RSI: 00000000000f4240 RDI: 0000000020000000
RBP: 00007f34e842f95c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 3030303030303030 R14: e4948bda8b418d12 R15: 00007f34e84637a8
</TASK>

Allocated by task 1616:
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:3238 [inline]
slab_alloc mm/slub.c:3246 [inline]
kmem_cache_alloc+0xf5/0x200 mm/slub.c:3251
kmem_cache_zalloc include/linux/slab.h:728 [inline]
locks_alloc_lock fs/locks.c:346 [inline]
flock_make_lock fs/locks.c:487 [inline]
__do_sys_flock fs/locks.c:2144 [inline]
__se_sys_flock+0x149/0x5a0 fs/locks.c:2125
__x64_sys_flock+0x5b/0x70 fs/locks.c:2125
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 1616:
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:3517 [inline]
kmem_cache_free+0x116/0x2e0 mm/slub.c:3533
locks_free_lock fs/locks.c:383 [inline]
__do_sys_flock fs/locks.c:2165 [inline]
__se_sys_flock+0x48d/0x5a0 fs/locks.c:2125
__x64_sys_flock+0x5b/0x70 fs/locks.c:2125
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 ffff888120092000
which belongs to the cache file_lock_cache of size 248
The buggy address is located 0 bytes inside of
248-byte region [ffff888120092000, ffff8881200920f8)
The buggy address belongs to the page:
page:ffffea0004802480 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x120092
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 0000000100000001 ffff8881003a7500
raw: 0000000000000000 00000000000d000d 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1624, ts 1446378834911, free_ts 1446365976540
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2502
prep_new_page mm/page_alloc.c:2508 [inline]
get_page_from_freelist+0x2c14/0x2cf0 mm/page_alloc.c:4291
__alloc_pages+0x386/0x7b0 mm/page_alloc.c:5569
allocate_slab mm/slub.c:1930 [inline]
new_slab+0x92/0x490 mm/slub.c:1993
___slab_alloc+0x39e/0x830 mm/slub.c:3026
__slab_alloc+0x4a/0x90 mm/slub.c:3113
slab_alloc_node mm/slub.c:3204 [inline]
slab_alloc mm/slub.c:3246 [inline]
kmem_cache_alloc+0x134/0x200 mm/slub.c:3251
kmem_cache_zalloc include/linux/slab.h:728 [inline]
locks_alloc_lock fs/locks.c:346 [inline]
flock_lock_inode+0x38a/0x14b0 fs/locks.c:1076
flock_lock_inode_wait fs/locks.c:2072 [inline]
locks_lock_inode_wait+0xf3/0x410 fs/locks.c:2099
locks_lock_file_wait include/linux/fs.h:1399 [inline]
__do_sys_flock fs/locks.c:2162 [inline]
__se_sys_flock+0x473/0x5a0 fs/locks.c:2125
__x64_sys_flock+0x5b/0x70 fs/locks.c:2125
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
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1370 [inline]
free_pcp_prepare mm/page_alloc.c:1442 [inline]
free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3441
free_unref_page+0xac/0x2c0 mm/page_alloc.c:3521
free_the_page mm/page_alloc.c:711 [inline]
__free_pages+0x39/0x100 mm/page_alloc.c:5642
__vunmap+0x7bc/0x8f0 mm/vmalloc.c:2652
free_work+0x5b/0x80 mm/vmalloc.c:96
process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313
worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460
kthread+0x421/0x510 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 <unknown>:298

Memory state around the buggy address:
ffff888120091f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888120091f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888120092000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888120092080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
ffff888120092100: fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Feb 22, 2023, 8:40:02 PM2/22/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 66c3e3ab77a2 ANDROID: incremental fs: Move throttling to o..
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=12d21dd8c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=e270749e5a0ba365
dashboard link: https://syzkaller.appspot.com/bug?extid=89d42537785a9b402274
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/029d1aebaf93/disk-66c3e3ab.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ff5b0997f038/vmlinux-66c3e3ab.xz
kernel image: https://storage.googleapis.com/syzbot-assets/58aab7df3af3/bzImage-66c3e3ab.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+89d425...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in crc16+0x1fc/0x280 lib/crc16.c:58
Read of size 1 at addr ffff888132654000 by task syz-executor.5/7383

CPU: 1 PID: 7383 Comm: syz-executor.5 Not tainted 5.4.225-syzkaller-00005-g66c3e3ab77a2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x241 lib/dump_stack.c:118
print_address_description+0x8c/0x600 mm/kasan/report.c:384
__kasan_report+0xf3/0x120 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
crc16+0x1fc/0x280 lib/crc16.c:58
ext4_group_desc_csum+0x90b/0xc40 fs/ext4/super.c:2544
ext4_group_desc_csum_set+0x197/0x230 fs/ext4/super.c:2567
ext4_free_blocks+0x138d/0x2310 fs/ext4/mballoc.c:4950
ext4_remove_blocks fs/ext4/extents.c:2708 [inline]
ext4_ext_rm_leaf fs/ext4/extents.c:2879 [inline]
ext4_ext_remove_space+0x259c/0x4ba0 fs/ext4/extents.c:3124
ext4_truncate+0xb26/0x12c0 fs/ext4/inode.c:4647
ext4_evict_inode+0x12e3/0x1b60 fs/ext4/inode.c:306
evict+0x29b/0x6a0 fs/inode.c:575
do_unlinkat+0x48e/0x8b0 fs/namei.c:4150
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Allocated by task 2755:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x130/0x1d0 mm/kasan/common.c:529
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2829 [inline]
slab_alloc mm/slub.c:2837 [inline]
kmem_cache_alloc+0xd0/0x220 mm/slub.c:2842
sk_prot_alloc+0x63/0x3e0 net/core/sock.c:1612
sk_alloc+0x30/0x3a0 net/core/sock.c:1676
tipc_sk_create+0xfb/0x18b0 net/tipc/socket.c:443
__sock_create+0x3cb/0x7a0 net/socket.c:1408
sock_create net/socket.c:1459 [inline]
__sys_socket+0x132/0x370 net/socket.c:1501
__do_sys_socket net/socket.c:1510 [inline]
__se_sys_socket net/socket.c:1508 [inline]
__x64_sys_socket+0x76/0x80 net/socket.c:1508
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Freed by task 155:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
kasan_set_free_info mm/kasan/common.c:345 [inline]
__kasan_slab_free+0x178/0x230 mm/kasan/common.c:487
slab_free_hook mm/slub.c:1455 [inline]
slab_free_freelist_hook mm/slub.c:1494 [inline]
slab_free mm/slub.c:3080 [inline]
kmem_cache_free+0xd5/0x290 mm/slub.c:3096
sk_prot_free net/core/sock.c:1657 [inline]
__sk_destruct+0x460/0x5e0 net/core/sock.c:1745
__rcu_reclaim kernel/rcu/rcu.h:222 [inline]
rcu_do_batch+0x492/0xa00 kernel/rcu/tree.c:2167
rcu_core+0x4c8/0xcb0 kernel/rcu/tree.c:2387
__do_softirq+0x22e/0x630 kernel/softirq.c:292

The buggy address belongs to the object at ffff888132654000
which belongs to the cache TIPC of size 1072
The buggy address is located 0 bytes inside of
1072-byte region [ffff888132654000, ffff888132654430)
The buggy address belongs to the page:
page:ffffea0004c99500 refcount:1 mapcount:0 mapping:ffff8881f0a63400 index:0xffff8881326557c0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 ffffea00079e5800 0000000400000004 ffff8881f0a63400
raw: ffff8881326557c0 00000000800d0000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL)
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook mm/page_alloc.c:2165 [inline]
prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
get_page_from_freelist+0x2ce8/0x2d70 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891
alloc_slab_page+0x39/0x3c0 mm/slub.c:343
allocate_slab mm/slub.c:1683 [inline]
new_slab+0x97/0x440 mm/slub.c:1749
new_slab_objects mm/slub.c:2505 [inline]
___slab_alloc+0x2fe/0x490 mm/slub.c:2667
__slab_alloc+0x5a/0x90 mm/slub.c:2707
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2837 [inline]
kmem_cache_alloc+0x100/0x220 mm/slub.c:2842
sk_prot_alloc+0x63/0x3e0 net/core/sock.c:1612
sk_alloc+0x30/0x3a0 net/core/sock.c:1676
tipc_sk_create+0xfb/0x18b0 net/tipc/socket.c:443
__sock_create+0x3cb/0x7a0 net/socket.c:1408
sock_create net/socket.c:1459 [inline]
__sys_socket+0x132/0x370 net/socket.c:1501
__do_sys_socket net/socket.c:1510 [inline]
__se_sys_socket net/socket.c:1508 [inline]
__x64_sys_socket+0x76/0x80 net/socket.c:1508
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1176 [inline]
free_pcp_prepare mm/page_alloc.c:1233 [inline]
free_unref_page_prepare+0x297/0x380 mm/page_alloc.c:3085
free_unref_page_list+0x10a/0x590 mm/page_alloc.c:3154
release_pages+0xa06/0xa40 mm/swap.c:842
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:184 [inline]
tlb_flush_mmu mm/mmu_gather.c:191 [inline]
tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:272
exit_mmap+0x2dc/0x520 mm/mmap.c:3188
__mmput+0x34/0x250 kernel/fork.c:1090
exit_mm kernel/exit.c:489 [inline]
do_exit+0xc08/0x2bc0 kernel/exit.c:799
do_group_exit+0x138/0x300 kernel/exit.c:910
get_signal+0xd94/0x13f0 kernel/signal.c:2735
do_signal+0xb0/0x11f0 arch/x86/kernel/signal.c:809
exit_to_usermode_loop+0xc0/0x1a0 arch/x86/entry/common.c:159
prepare_exit_to_usermode+0x199/0x200 arch/x86/entry/common.c:194
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Memory state around the buggy address:
ffff888132653f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888132653f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888132654000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888132654080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888132654100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

syzbot

unread,
Aug 15, 2023, 10:19:45 AM8/15/23
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages