[f2fs?] KASAN: use-after-free Read in f2fs_release_page

已查看 4 次
跳至第一个未读帖子

syzbot

未读,
2022年12月25日 01:22:582022/12/25
收件人 syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: a8aad8851131 ANDROID: GKI: enable mulitcolor-led
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=10774164480000
kernel config: https://syzkaller.appspot.com/x/.config?x=b4f7fdc1fca3154e
dashboard link: https://syzkaller.appspot.com/bug?extid=22816d25c2e79b0ce574
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, 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/71fa3d1afcd2/disk-a8aad885.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6d25e2985873/vmlinux-a8aad885.xz
kernel image: https://storage.googleapis.com/syzbot-assets/97866ff1e151/bzImage-a8aad885.xz

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

==================================================================
BUG: KASAN: use-after-free in F2FS_SB fs/f2fs/f2fs.h:1884 [inline]
BUG: KASAN: use-after-free in F2FS_I_SB fs/f2fs/f2fs.h:1889 [inline]
BUG: KASAN: use-after-free in F2FS_M_SB fs/f2fs/f2fs.h:1894 [inline]
BUG: KASAN: use-after-free in F2FS_P_SB fs/f2fs/f2fs.h:1899 [inline]
BUG: KASAN: use-after-free in f2fs_release_page+0x2b1/0xa20 fs/f2fs/data.c:3800
Read of size 8 at addr ffff8881e350b3f0 by task syz-executor.2/2597

CPU: 1 PID: 2597 Comm: syz-executor.2 Not tainted 5.4.219-syzkaller-00012-ga8aad8851131 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x241 lib/dump_stack.c:118
print_address_description+0x8c/0x630 mm/kasan/report.c:384
__kasan_report+0xf6/0x130 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
F2FS_SB fs/f2fs/f2fs.h:1884 [inline]
F2FS_I_SB fs/f2fs/f2fs.h:1889 [inline]
F2FS_M_SB fs/f2fs/f2fs.h:1894 [inline]
F2FS_P_SB fs/f2fs/f2fs.h:1899 [inline]
f2fs_release_page+0x2b1/0xa20 fs/f2fs/data.c:3800
shrink_page_list+0x135c/0x3360 mm/vmscan.c:1447
shrink_inactive_list+0x51e/0xf60 mm/vmscan.c:1997
shrink_list mm/vmscan.c:2288 [inline]
shrink_node_memcg+0x5c1/0x1080 mm/vmscan.c:2618
shrink_node+0x3be/0x1350 mm/vmscan.c:2831
shrink_zones+0x48d/0x960 mm/vmscan.c:3048
do_try_to_free_pages+0x21b/0x990 mm/vmscan.c:3106
try_to_free_mem_cgroup_pages+0x3e5/0x960 mm/vmscan.c:3407
memory_high_write+0x16a/0x1b0 mm/memcontrol.c:6162
cgroup_file_write+0x273/0x5c0 kernel/cgroup/cgroup.c:3898
kernfs_fop_write+0x2ec/0x3e0 fs/kernfs/file.c:315
__vfs_write+0x103/0x780 fs/read_write.c:494
vfs_write+0x210/0x4f0 fs/read_write.c:558
ksys_write+0x198/0x2c0 fs/read_write.c:611
do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Allocated by task 31908:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x131/0x1e0 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]
__kmalloc_track_caller+0xfb/0x280 mm/slub.c:4449
kmemdup+0x21/0x50 mm/util.c:127
neigh_sysctl_register+0xb0/0x550 net/core/neighbour.c:3657
addrconf_sysctl_register+0xac/0x180 net/ipv6/addrconf.c:6988
ipv6_add_dev+0xc0a/0x1050 net/ipv6/addrconf.c:445
addrconf_notify+0x591/0xe60 net/ipv6/addrconf.c:3534
notifier_call_chain kernel/notifier.c:98 [inline]
__raw_notifier_call_chain kernel/notifier.c:399 [inline]
raw_notifier_call_chain+0x9d/0x110 kernel/notifier.c:406
call_netdevice_notifiers_info net/core/dev.c:1670 [inline]
call_netdevice_notifiers_extack net/core/dev.c:1682 [inline]
call_netdevice_notifiers net/core/dev.c:1696 [inline]
register_netdevice+0xea7/0x1260 net/core/dev.c:9207
vti6_tnl_create2+0xb3/0x2d0 net/ipv6/ip6_vti.c:189
vti6_tnl_create net/ipv6/ip6_vti.c:228 [inline]
vti6_locate+0x5a6/0x660 net/ipv6/ip6_vti.c:276
vti6_ioctl+0xa7f/0x17d0 net/ipv6/ip6_vti.c:830
dev_ifsioc+0x675/0xa70 net/core/dev_ioctl.c:311
dev_ioctl+0x558/0xab0 net/core/dev_ioctl.c:508
sock_ioctl+0x689/0x760 net/socket.c:1093
do_vfs_ioctl+0x744/0x1730 fs/ioctl.c:47
ksys_ioctl fs/ioctl.c:742 [inline]
__do_sys_ioctl fs/ioctl.c:749 [inline]
__se_sys_ioctl fs/ioctl.c:747 [inline]
__x64_sys_ioctl+0xd4/0x110 fs/ioctl.c:747
do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Freed by task 26990:
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/0x240 mm/kasan/common.c:487
slab_free_hook mm/slub.c:1455 [inline]
slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494
slab_free mm/slub.c:3080 [inline]
kfree+0xc6/0x260 mm/slub.c:4071
addrconf_sysctl_unregister net/ipv6/addrconf.c:7004 [inline]
addrconf_ifdown+0x187e/0x1af0 net/ipv6/addrconf.c:3905
addrconf_notify+0x36f/0xe60 net/ipv6/addrconf.c:3676
notifier_call_chain kernel/notifier.c:98 [inline]
__raw_notifier_call_chain kernel/notifier.c:399 [inline]
raw_notifier_call_chain+0x9d/0x110 kernel/notifier.c:406
call_netdevice_notifiers_info net/core/dev.c:1670 [inline]
call_netdevice_notifiers_extack net/core/dev.c:1682 [inline]
call_netdevice_notifiers net/core/dev.c:1696 [inline]
rollback_registered_many+0xcdb/0x1370 net/core/dev.c:8617
unregister_netdevice_many+0x46/0x260 net/core/dev.c:9774
vti6_exit_batch_net+0x29b/0x2e0 net/ipv6/ip6_vti.c:1176
ops_exit_list net/core/net_namespace.c:177 [inline]
cleanup_net+0x77c/0xd60 net/core/net_namespace.c:602
process_one_work+0x6ca/0xc40 kernel/workqueue.c:2287
worker_thread+0xae0/0x1440 kernel/workqueue.c:2433
kthread+0x2d8/0x360 kernel/kthread.c:288
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354

The buggy address belongs to the object at ffff8881e350b000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1008 bytes inside of
2048-byte region [ffff8881e350b000, ffff8881e350b800)
The buggy address belongs to the page:
page:ffffea00078d4200 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c000
raw: 0000000000000000 0000000000080008 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 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+0x194/0x380 mm/page_alloc.c:2171
get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x372/0x860 mm/page_alloc.c:4891
alloc_slab_page+0x39/0x3e0 mm/slub.c:343
allocate_slab mm/slub.c:1683 [inline]
new_slab+0x97/0x450 mm/slub.c:1749
new_slab_objects mm/slub.c:2505 [inline]
___slab_alloc+0x320/0x4a0 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_trace+0x129/0x240 mm/slub.c:2854
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:690 [inline]
ext4_fill_super+0xf8/0x8ce0 fs/ext4/super.c:3705
mount_bdev+0x22d/0x340 fs/super.c:1417
legacy_get_tree+0xde/0x170 fs/fs_context.c:647
vfs_get_tree+0x85/0x260 fs/super.c:1547
do_new_mount+0x299/0x580 fs/namespace.c:2843
do_mount+0x6ac/0xe10 fs/namespace.c:3163
ksys_mount+0xc2/0xf0 fs/namespace.c:3372
__do_sys_mount fs/namespace.c:3386 [inline]
__se_sys_mount fs/namespace.c:3383 [inline]
__x64_sys_mount+0xb1/0xc0 fs/namespace.c:3383
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_pages_ok+0x7fe/0x930 mm/page_alloc.c:1438
free_the_page mm/page_alloc.c:4953 [inline]
__free_pages+0x8f/0x250 mm/page_alloc.c:4959
__free_slab+0x22b/0x2e0 mm/slub.c:1774
free_slab mm/slub.c:1789 [inline]
discard_slab mm/slub.c:1795 [inline]
unfreeze_partials+0x14f/0x180 mm/slub.c:2288
put_cpu_partial+0xb5/0x150 mm/slub.c:2324
__slab_free+0x2ac/0x370 mm/slub.c:2971
qlist_free_all+0x4c/0xb0 mm/kasan/quarantine.c:167
quarantine_reduce+0x174/0x190 mm/kasan/quarantine.c:260
__kasan_kmalloc+0x43/0x1e0 mm/kasan/common.c:507
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2829 [inline]
slab_alloc mm/slub.c:2837 [inline]
__kmalloc_track_caller+0xfb/0x280 mm/slub.c:4449
kvasprintf+0xd6/0x180 lib/kasprintf.c:25
kobject_set_name_vargs+0x5d/0x110 lib/kobject.c:289
kobject_add_varg lib/kobject.c:384 [inline]
kobject_init_and_add+0xdb/0x190 lib/kobject.c:473
netdev_queue_add_kobject net/core/net-sysfs.c:1567 [inline]
netdev_queue_update_kobjects+0x16e/0x3b0 net/core/net-sysfs.c:1595
register_queue_kobjects net/core/net-sysfs.c:1637 [inline]
netdev_register_kobject+0x263/0x310 net/core/net-sysfs.c:1858
register_netdevice+0xb82/0x1260 net/core/dev.c:9176

Memory state around the buggy address:
ffff8881e350b280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881e350b300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881e350b380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881e350b400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881e350b480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 2597 Comm: syz-executor.2 Tainted: G B 5.4.219-syzkaller-00012-ga8aad8851131 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:f2fs_release_page+0x2c1/0xa20 fs/f2fs/data.c:3800
Code: 00 4c 03 23 4c 89 e0 48 c1 e8 03 42 80 3c 30 00 74 08 4c 89 e7 e8 2f 61 9f ff bb 90 05 00 00 49 03 1c 24 48 89 d8 48 c1 e8 03 <42> 8a 04 30 84 c0 0f 85 fd 06 00 00 8b 1b bd 00 00 00 40 be 00 00
RSP: 0018:ffff8881e588ee10 EFLAGS: 00010206
RAX: 00000000000000b2 RBX: 0000000000000590 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000246 RDI: 0000000000000001
RBP: 0000000000000000 R08: dffffc0000000000 R09: fffffbfff0d9270d
R10: fffffbfff0d9270d R11: 1ffffffff0d9270c R12: ffff8881e350b3f0
R13: ffffea00077bbf48 R14: dffffc0000000000 R15: ffffea00077bbf40
FS: 00007fd2d2354700(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6351409000 CR3: 00000001ef044000 CR4: 00000000003406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
shrink_page_list+0x135c/0x3360 mm/vmscan.c:1447
shrink_inactive_list+0x51e/0xf60 mm/vmscan.c:1997
shrink_list mm/vmscan.c:2288 [inline]
shrink_node_memcg+0x5c1/0x1080 mm/vmscan.c:2618
shrink_node+0x3be/0x1350 mm/vmscan.c:2831
shrink_zones+0x48d/0x960 mm/vmscan.c:3048
do_try_to_free_pages+0x21b/0x990 mm/vmscan.c:3106
try_to_free_mem_cgroup_pages+0x3e5/0x960 mm/vmscan.c:3407
memory_high_write+0x16a/0x1b0 mm/memcontrol.c:6162
cgroup_file_write+0x273/0x5c0 kernel/cgroup/cgroup.c:3898
kernfs_fop_write+0x2ec/0x3e0 fs/kernfs/file.c:315
__vfs_write+0x103/0x780 fs/read_write.c:494
vfs_write+0x210/0x4f0 fs/read_write.c:558
ksys_write+0x198/0x2c0 fs/read_write.c:611
do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
Modules linked in:
---[ end trace 301b6539a2284424 ]---
RIP: 0010:f2fs_release_page+0x2c1/0xa20 fs/f2fs/data.c:3800
Code: 00 4c 03 23 4c 89 e0 48 c1 e8 03 42 80 3c 30 00 74 08 4c 89 e7 e8 2f 61 9f ff bb 90 05 00 00 49 03 1c 24 48 89 d8 48 c1 e8 03 <42> 8a 04 30 84 c0 0f 85 fd 06 00 00 8b 1b bd 00 00 00 40 be 00 00
RSP: 0018:ffff8881e588ee10 EFLAGS: 00010206
RAX: 00000000000000b2 RBX: 0000000000000590 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000246 RDI: 0000000000000001
RBP: 0000000000000000 R08: dffffc0000000000 R09: fffffbfff0d9270d
R10: fffffbfff0d9270d R11: 1ffffffff0d9270c R12: ffff8881e350b3f0
R13: ffffea00077bbf48 R14: dffffc0000000000 R15: ffffea00077bbf40
FS: 00007fd2d2354700(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6f4f3b0058 CR3: 00000001ef044000 CR4: 00000000003406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 00 4c 03 23 add %cl,0x23(%rbx,%rax,1)
4: 4c 89 e0 mov %r12,%rax
7: 48 c1 e8 03 shr $0x3,%rax
b: 42 80 3c 30 00 cmpb $0x0,(%rax,%r14,1)
10: 74 08 je 0x1a
12: 4c 89 e7 mov %r12,%rdi
15: e8 2f 61 9f ff callq 0xff9f6149
1a: bb 90 05 00 00 mov $0x590,%ebx
1f: 49 03 1c 24 add (%r12),%rbx
23: 48 89 d8 mov %rbx,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 8a 04 30 mov (%rax,%r14,1),%al <-- trapping instruction
2e: 84 c0 test %al,%al
30: 0f 85 fd 06 00 00 jne 0x733
36: 8b 1b mov (%rbx),%ebx
38: bd 00 00 00 40 mov $0x40000000,%ebp
3d: be .byte 0xbe


---
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

未读,
2023年8月1日 19:35:562023/8/1
收件人 syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
回复全部
回复作者
转发
0 个新帖子