syzbot


KASAN: use-after-free Read in unaccount_page_cache_page (2)

Status: premoderation: reported on 2024/08/13 21:29
Reported-by: syzbot+0103643afaaf21167ae4@syzkaller.appspotmail.com
First crash: 33d, last: 33d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in unaccount_page_cache_page 118 194d 669d 0/2 auto-obsoleted due to no activity on 2024/05/01 01:14
android-5-10 KASAN: use-after-free Read in unaccount_page_cache_page 150 148d 676d 0/2 auto-obsoleted due to no activity on 2024/06/10 16:28
android-54 KASAN: slab-out-of-bounds Read in unaccount_page_cache_page 2 229d 310d 0/2 auto-obsoleted due to no activity on 2024/04/30 10:15
android-5-15 KASAN: use-after-free Read in unaccount_page_cache_page (2) 1 24d 24d 0/2 premoderation: reported on 2024/08/23 02:36
android-54 KASAN: use-after-free Read in unaccount_page_cache_page 143 460d 674d 0/2 auto-obsoleted due to no activity on 2023/08/23 09:09

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in cleancache_fs_enabled_mapping include/linux/cleancache.h:56 [inline]
BUG: KASAN: use-after-free in cleancache_invalidate_page include/linux/cleancache.h:110 [inline]
BUG: KASAN: use-after-free in unaccount_page_cache_page+0x99f/0xa80 mm/filemap.c:175
Read of size 4 at addr ffff8881230cb470 by task syz.3.6439/23083

CPU: 0 PID: 23083 Comm: syz.3.6439 Not tainted 5.10.223-syzkaller-01561-g0890c03b8b7d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 cleancache_fs_enabled_mapping include/linux/cleancache.h:56 [inline]
 cleancache_invalidate_page include/linux/cleancache.h:110 [inline]
 unaccount_page_cache_page+0x99f/0xa80 mm/filemap.c:175
 __delete_from_page_cache+0xd0/0x5d0 mm/filemap.c:243
 __remove_mapping+0x567/0x690 mm/vmscan.c:978
 shrink_page_list+0x1f38/0x4c60 mm/vmscan.c:1491
 shrink_inactive_list+0x591/0x1150 mm/vmscan.c:2068
 shrink_list mm/vmscan.c:2287 [inline]
 shrink_lruvec+0xced/0x3860 mm/vmscan.c:5466
 shrink_node_memcgs mm/vmscan.c:5653 [inline]
 shrink_node+0xded/0x2000 mm/vmscan.c:5683
 shrink_zones mm/vmscan.c:5889 [inline]
 do_try_to_free_pages+0x652/0x1630 mm/vmscan.c:5947
 try_to_free_mem_cgroup_pages+0x369/0x830 mm/vmscan.c:6265
 try_charge+0x4b8/0x15f0 mm/memcontrol.c:2742
 __mem_cgroup_charge+0x147/0x6e0 mm/memcontrol.c:6848
 mem_cgroup_charge include/linux/memcontrol.h:458 [inline]
 shmem_add_to_page_cache+0x6a9/0x10c0 mm/shmem.c:699
 shmem_getpage_gfp+0xa65/0x2480 mm/shmem.c:1952
 shmem_getpage mm/shmem.c:161 [inline]
 shmem_write_begin+0xca/0x1b0 mm/shmem.c:2500
 generic_perform_write+0x2cd/0x570 mm/filemap.c:3509
 __generic_file_write_iter+0x23c/0x560 mm/filemap.c:3638
 generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:3670
 __kernel_write+0x5ab/0x9d0 fs/read_write.c:550
 dump_emit+0x261/0x3a0 fs/coredump.c:849
 dump_user_range+0x71/0x1a0 fs/coredump.c:902
 elf_core_dump+0x33bd/0x3c10 fs/binfmt_elf.c:2287
 do_coredump+0x1eb8/0x2d60 fs/coredump.c:811
 get_signal+0x102c/0x1410 kernel/signal.c:2768
 arch_do_signal_or_restart+0xbd/0x17c0 arch/x86/kernel/signal.c:805
 handle_signal_work kernel/entry/common.c:145 [inline]
 exit_to_user_mode_loop+0x9b/0xd0 kernel/entry/common.c:169
 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
 irqentry_exit_to_user_mode+0x4e/0x80 kernel/entry/common.c:287
 irqentry_exit+0x12/0x60 kernel/entry/common.c:375
 exc_page_fault+0x33d/0x5b0 arch/x86/mm/fault.c:1487
 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571
RIP: 0033:0x7f4d003f1307
Code: 88 15 ea 93 e0 00 88 05 e7 93 e0 00 c3 50 48 8d 35 f6 b5 1a 00 48 8d 3d fc b5 1a 00 31 c0 e8 a0 f9 ff ff 53 89 fb 48 83 ec 10 <64> 8b 04 25 94 ff ff ff 85 c0 74 2a 89 fe 31 c0 bf 3c 00 00 00 e8
RSP: 002b:00007f4cfef28120 EFLAGS: 00010202
RAX: 0000000000000000 RBX: 000000000000000b RCX: 00007f4d0052e9f9
RDX: 00007f4cfef28140 RSI: 00007f4cfef28270 RDI: 000000000000000b
RBP: 00007f4d0059c8ee R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f4d006cb208 R15: 00007ffd9f1bc9c8

Allocated by task 19601:
 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:430 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:509
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x1aa/0x330 mm/slub.c:4033
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 ops_init+0x8e/0x4a0 net/core/net_namespace.c:134
 setup_net+0x367/0xbf0 net/core/net_namespace.c:345
 copy_net_ns+0x32f/0x520 net/core/net_namespace.c:486
 create_new_namespaces+0x410/0x660 kernel/nsproxy.c:110
 copy_namespaces+0x1d1/0x220 kernel/nsproxy.c:179
 copy_process+0x11a0/0x3340 kernel/fork.c:2186
 kernel_clone+0x21e/0x9e0 kernel/fork.c:2574
 __do_sys_clone kernel/fork.c:2700 [inline]
 __se_sys_clone kernel/fork.c:2684 [inline]
 __x64_sys_clone+0x23f/0x290 kernel/fork.c:2684
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 22591:
 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+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kfree+0xc3/0x270 mm/slub.c:4191
 skb_free_head net/core/skbuff.c:606 [inline]
 skb_release_data+0x5c6/0x6f0 net/core/skbuff.c:626
 skb_release_all net/core/skbuff.c:680 [inline]
 __kfree_skb net/core/skbuff.c:694 [inline]
 kfree_skb+0xb9/0x320 net/core/skbuff.c:713
 neigh_connected_output+0x427/0x450 net/core/neighbour.c:1541
 neigh_output include/net/neighbour.h:517 [inline]
 ip_finish_output2+0xb7a/0xfc0 net/ipv4/ip_output.c:237
 ip_do_fragment+0xc22/0x2310 net/ipv4/ip_output.c:921
 ip_fragment+0x123/0x210
 __ip_finish_output+0x557/0x740 net/ipv4/ip_output.c:313
 ip_finish_output+0x34/0x1e0 net/ipv4/ip_output.c:325
 NF_HOOK_COND include/linux/netfilter.h:288 [inline]
 ip_mc_output+0x3d3/0xa30 net/ipv4/ip_output.c:424
 dst_output include/net/dst.h:437 [inline]
 ip_local_out+0x92/0xb0 net/ipv4/ip_output.c:126
 iptunnel_xmit+0x470/0x850 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x1e64/0x2760 net/ipv4/ip_tunnel.c:824
 __gre_xmit net/ipv4/ip_gre.c:469 [inline]
 ipgre_xmit+0x87a/0xc30 net/ipv4/ip_gre.c:664
 __netdev_start_xmit include/linux/netdevice.h:4858 [inline]
 netdev_start_xmit include/linux/netdevice.h:4872 [inline]
 xmit_one net/core/dev.c:3607 [inline]
 dev_hard_start_xmit+0x228/0x620 net/core/dev.c:3623
 __dev_queue_xmit+0x16f1/0x28e0 net/core/dev.c:4190
 dev_queue_xmit+0x17/0x20 net/core/dev.c:4223
 __bpf_tx_skb net/core/filter.c:2120 [inline]
 __bpf_redirect_no_mac net/core/filter.c:2154 [inline]
 __bpf_redirect+0x665/0xde0 net/core/filter.c:2177
 ____bpf_clone_redirect net/core/filter.c:2461 [inline]
 bpf_clone_redirect+0x24d/0x390 net/core/filter.c:2433
 0xffffffffa00165e6
 bpf_dispatcher_nop_func include/linux/bpf.h:669 [inline]
 bpf_test_run+0x40b/0xc20 net/bpf/test_run.c:116
 bpf_prog_test_run_skb+0xb6e/0x1410 net/bpf/test_run.c:635
 bpf_prog_test_run kernel/bpf/syscall.c:3156 [inline]
 __do_sys_bpf kernel/bpf/syscall.c:4453 [inline]
 __se_sys_bpf+0x5235/0x11cb0 kernel/bpf/syscall.c:4391
 __x64_sys_bpf+0x7b/0x90 kernel/bpf/syscall.c:4391
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2976 [inline]
 call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050
 netlink_release+0x12df/0x16f0 net/netlink/af_netlink.c:811
 __sock_release net/socket.c:597 [inline]
 sock_release+0x7e/0x140 net/socket.c:625
 netlink_kernel_release+0x4d/0x60 net/netlink/af_netlink.c:2104
 nl_fib_lookup_exit net/ipv4/fib_frontend.c:1409 [inline]
 fib_net_exit+0x4b/0x80 net/ipv4/fib_frontend.c:1614
 ops_exit_list net/core/net_namespace.c:185 [inline]
 cleanup_net+0x66c/0xcb0 net/core/net_namespace.c:609
 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2976 [inline]
 call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050
 netlink_release+0x12df/0x16f0 net/netlink/af_netlink.c:811
 __sock_release net/socket.c:597 [inline]
 sock_release+0x7e/0x140 net/socket.c:625
 netlink_kernel_release+0x4d/0x60 net/netlink/af_netlink.c:2104
 nfnetlink_net_exit_batch+0xd3/0x110 net/netfilter/nfnetlink.c:649
 ops_exit_list net/core/net_namespace.c:190 [inline]
 cleanup_net+0x6e9/0xcb0 net/core/net_namespace.c:609
 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff8881230cb000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1136 bytes inside of
 2048-byte region [ffff8881230cb000, ffff8881230cb800)
The buggy address belongs to the page:
page:ffffea00048c3200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8881230c9000 pfn:0x1230c8
head:ffffea00048c3200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 ffffea00047a7a08 ffffea0005701608 ffff888100042d80
raw: ffff8881230c9000 0000000000080007 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 285, ts 20108417294, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 __kmalloc_track_caller+0x1f8/0x320 mm/slub.c:4536
 kmemdup+0x24/0x50 mm/util.c:131
 neigh_sysctl_register+0xb0/0x530 net/core/neighbour.c:3647
 addrconf_sysctl_register+0xae/0x1a0 net/ipv6/addrconf.c:7078
 ipv6_add_dev+0xc11/0x10b0 net/ipv6/addrconf.c:448
 addrconf_notify+0x58e/0xe90 net/ipv6/addrconf.c:3566
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:410
 call_netdevice_notifiers_info net/core/dev.c:2054 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2066 [inline]
 call_netdevice_notifiers+0x145/0x1b0 net/core/dev.c:2080
 register_netdevice+0x1066/0x13f0 net/core/dev.c:10067
 veth_newlink+0x835/0xb50 drivers/net/veth.c:1387
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881230cb300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881230cb380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881230cb400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff8881230cb480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881230cb500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/13 21:28 android13-5.10-lts 0890c03b8b7d f21a18ca .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in unaccount_page_cache_page
* Struck through repros no longer work on HEAD.