KASAN: use-after-free Read in unaccount_page_cache_page

26 views
Skip to first unread message

syzbot

unread,
Nov 12, 2022, 11:10:51 AM11/12/22
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 5a34019eb955 UPSTREAM: irqchip/tegra: Fix overflow implici..
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=15083e8e880000
kernel config: https://syzkaller.appspot.com/x/.config?x=587759e0bb2a632a
dashboard link: https://syzkaller.appspot.com/bug?extid=e1314fa90cb4ae2450ca
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/75c80919b619/disk-5a34019e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/71e7a5761c72/vmlinux-5a34019e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0f6bc1f43ba7/bzImage-5a34019e.xz

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

==================================================================
BUG: KASAN: use-after-free in cleancache_fs_enabled_mapping include/linux/cleancache.h:54 [inline]
BUG: KASAN: use-after-free in cleancache_invalidate_page include/linux/cleancache.h:108 [inline]
BUG: KASAN: use-after-free in unaccount_page_cache_page+0x651/0x6c0 mm/filemap.c:169
Read of size 4 at addr ffff8881dada7488 by task syz-executor.2/12690

CPU: 1 PID: 12690 Comm: syz-executor.2 Not tainted 5.4.210-syzkaller-00003-g5a34019eb955 #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+0x18e/0x1d5 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
cleancache_fs_enabled_mapping include/linux/cleancache.h:54 [inline]
cleancache_invalidate_page include/linux/cleancache.h:108 [inline]
unaccount_page_cache_page+0x651/0x6c0 mm/filemap.c:169
__delete_from_page_cache+0x69/0x450 mm/filemap.c:237
__remove_mapping+0x474/0x550 mm/vmscan.c:978
shrink_page_list+0x1dd5/0x3140 mm/vmscan.c:1478
shrink_inactive_list+0x4a7/0xea0 mm/vmscan.c:1997
shrink_list mm/vmscan.c:2288 [inline]
shrink_node_memcg+0x501/0xf40 mm/vmscan.c:2618
shrink_node+0x364/0x1320 mm/vmscan.c:2831
shrink_zones+0x416/0x8b0 mm/vmscan.c:3048
do_try_to_free_pages+0x21b/0x990 mm/vmscan.c:3106
try_to_free_mem_cgroup_pages+0x32d/0x850 mm/vmscan.c:3407
try_charge+0x44a/0x1100 mm/memcontrol.c:2616
mem_cgroup_try_charge+0xd5/0x2a0 mm/memcontrol.c:6571
__add_to_page_cache_locked+0x1c1/0x820 mm/filemap.c:865
add_to_page_cache_lru+0xcf/0x260 mm/filemap.c:962
pagecache_get_page+0x539/0x760 mm/filemap.c:1701
grab_cache_page_write_begin+0x50/0x90 mm/filemap.c:3261
ext4_da_write_begin+0x52b/0xef0 fs/ext4/inode.c:3137
generic_perform_write+0x290/0x510 mm/filemap.c:3311
__generic_file_write_iter+0x239/0x490 mm/filemap.c:3440
ext4_file_write_iter+0x46e/0x1040 fs/ext4/file.c:270
call_write_iter include/linux/fs.h:1976 [inline]
new_sync_write fs/read_write.c:483 [inline]
__vfs_write+0x4f9/0x6a0 fs/read_write.c:496
__kernel_write+0x12c/0x340 fs/read_write.c:515
dump_emit+0x1cc/0x2d0 fs/coredump.c:838
elf_core_dump+0x39f1/0x42a0 fs/binfmt_elf.c:2352
do_coredump+0x1d70/0x2ca0 fs/coredump.c:801
get_signal+0xd5b/0x13f0 kernel/signal.c:2729
do_signal+0x41/0x10a0 arch/x86/kernel/signal.c:809
exit_to_usermode_loop+0xdd/0x1d0 arch/x86/entry/common.c:159
prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194
retint_user+0x8/0x8
RIP: 0033:0x7efe0f28a641
Code: 00 00 00 00 00 0f 1f 40 00 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 83 c8 ff c3 66 2e 0f 1f
RSP: 002b:0000000000000030 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007efe0f3ab050 RCX: 00007efe0f28a639
RDX: 0000000000000000 RSI: 0000000000000030 RDI: 0000000000020000
RBP: 00007efe0f2e5a41 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007ffc890f3c2f R14: 00007efe0dfdd300 R15: 0000000000022000

Allocated by task 12633:
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
kmalloc include/linux/slab.h:561 [inline]
kzalloc include/linux/slab.h:690 [inline]
__register_sysctl_table+0xe7/0x11c0 fs/proc/proc_sysctl.c:1331
__devinet_sysctl_register+0x1a4/0x240 net/ipv4/devinet.c:2575
devinet_sysctl_register+0x139/0x1a0 net/ipv4/devinet.c:2615
inetdev_init+0x24c/0x460 net/ipv4/devinet.c:276
inetdev_event+0x1cc/0x1030 net/ipv4/devinet.c:1531
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+0xd9e/0x1140 net/core/dev.c:9206
register_netdev+0x37/0x50 net/core/dev.c:9304
sit_init_net+0x228/0x420 net/ipv6/sit.c:1864
ops_init+0x278/0x350 net/core/net_namespace.c:137
setup_net+0x1bb/0x9e0 net/core/net_namespace.c:338
copy_net_ns+0x31a/0x510 net/core/net_namespace.c:479
create_new_namespaces+0x4e3/0x5f0 kernel/nsproxy.c:103
copy_namespaces+0x169/0x1b0 kernel/nsproxy.c:161
copy_process+0x12a4/0x31f0 kernel/fork.c:2044
_do_fork+0x142/0x7f0 kernel/fork.c:2391
__do_sys_clone kernel/fork.c:2549 [inline]
__se_sys_clone kernel/fork.c:2530 [inline]
__x64_sys_clone+0x213/0x260 kernel/fork.c:2530
do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 12683:
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
__rcu_reclaim kernel/rcu/rcu.h:215 [inline]
rcu_do_batch+0x3d9/0x910 kernel/rcu/tree.c:2167
rcu_core+0x448/0xbc0 kernel/rcu/tree.c:2387
__do_softirq+0x23e/0x643 kernel/softirq.c:292

The buggy address belongs to the object at ffff8881dada7000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1160 bytes inside of
2048-byte region [ffff8881dada7000, ffff8881dada7800)
The buggy address belongs to the page:
page:ffffea00076b6800 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 0x1d2a20(GFP_ATOMIC|__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+0x2ab/0x6f0 mm/page_alloc.c:4857
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]
__kmalloc_track_caller+0x168/0x280 mm/slub.c:4449
__kmalloc_reserve net/core/skbuff.c:142 [inline]
pskb_expand_head+0x118/0x1060 net/core/skbuff.c:1639
netlink_trim+0x194/0x230 net/netlink/af_netlink.c:1294
netlink_broadcast_filtered+0x6c/0x11d0 net/netlink/af_netlink.c:1499
netlink_broadcast net/netlink/af_netlink.c:1544 [inline]
nlmsg_multicast include/net/netlink.h:968 [inline]
nlmsg_notify+0xf6/0x1c0 net/netlink/af_netlink.c:2542
__dev_notify_flags+0x77/0x3c0 net/core/dev.c:7958
dev_change_flags+0xe3/0x190 net/core/dev.c:8000
do_setlink+0xbdd/0x3880 net/core/rtnetlink.c:2520
__rtnl_newlink net/core/rtnetlink.c:3163 [inline]
rtnl_newlink+0x14ae/0x1e30 net/core/rtnetlink.c:3289
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+0x7ee/0x920 mm/page_alloc.c:1438
free_the_page mm/page_alloc.c:4919 [inline]
__free_pages+0x45/0x1e0 mm/page_alloc.c:4925
__free_slab+0x22b/0x2e0 mm/slub.c:1774
__slab_free+0x362/0x370 mm/slub.c:3012
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]
kmem_cache_alloc+0xd0/0x210 mm/slub.c:2842
kmem_cache_alloc_node include/linux/slab.h:427 [inline]
__alloc_skb+0x78/0x4d0 net/core/skbuff.c:198
alloc_skb include/linux/skbuff.h:1060 [inline]
nlmsg_new include/net/netlink.h:888 [inline]
netlink_ack+0x281/0x9c0 net/netlink/af_netlink.c:2433
netlink_rcv_skb+0x208/0x3a0 net/netlink/af_netlink.c:2505
netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
netlink_unicast+0x856/0xa20 net/netlink/af_netlink.c:1338
netlink_sendmsg+0x939/0xc00 net/netlink/af_netlink.c:1933
sock_sendmsg_nosec net/socket.c:638 [inline]
sock_sendmsg net/socket.c:658 [inline]
__sys_sendto+0x42a/0x5c0 net/socket.c:1942
__do_sys_sendto net/socket.c:1954 [inline]
__se_sys_sendto net/socket.c:1950 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:1950
do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290

Memory state around the buggy address:
ffff8881dada7380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881dada7400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881dada7480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881dada7500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881dada7580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
syz-executor.2 (12690) used greatest stack depth: 23752 bytes left


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

unread,
Aug 23, 2023, 5:09:34 AM8/23/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