syzbot


KASAN: use-after-free Write in __tlb_remove_page_size

Status: premoderation: reported on 2024/09/06 02:58
Reported-by: syzbot+1f8d24c59335b25ce73b@syzkaller.appspotmail.com
First crash: 76d, last: 76d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __tlb_remove_page_size+0x8d/0x300 mm/mmu_gather.c:81
Write of size 8 at addr ffff8881063b1000 by task syz.0.119/832

CPU: 0 PID: 832 Comm: syz.0.119 Not tainted 5.10.223-syzkaller-00011-g1c5354a314ea #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/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_store8_noabort+0x17/0x20 mm/kasan/report_generic.c:314
 __tlb_remove_page_size+0x8d/0x300 mm/mmu_gather.c:81
 __tlb_remove_page include/asm-generic/tlb.h:442 [inline]
 zap_pte_range mm/memory.c:1319 [inline]
 zap_pmd_range mm/memory.c:1435 [inline]
 zap_pud_range mm/memory.c:1464 [inline]
 zap_p4d_range mm/memory.c:1485 [inline]
 unmap_page_range+0x121b/0x23b0 mm/memory.c:1506
 unmap_single_vma mm/memory.c:1551 [inline]
 unmap_vmas+0x37f/0x4f0 mm/memory.c:1583
 exit_mmap+0x2f2/0x5c0 mm/mmap.c:3355
 __mmput+0x95/0x2d0 kernel/fork.c:1153
 mmput+0x59/0x170 kernel/fork.c:1176
 exit_mm kernel/exit.c:539 [inline]
 do_exit+0xbda/0x2a50 kernel/exit.c:850
 do_group_exit+0x141/0x310 kernel/exit.c:985
 get_signal+0x10a0/0x1410 kernel/signal.c:2782
 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]
 syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274
 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7eff11e2eef9
Code: Unable to access opcode bytes at RIP 0x7eff11e2eecf.
RSP: 002b:00007eff10a880e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007eff11fe8060 RCX: 00007eff11e2eef9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007eff11fe8060
RBP: 00007eff11fe8058 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007eff11fe8064
R13: 0000000000000000 R14: 00007ffe863c9e90 R15: 00007ffe863c9f78

Allocated by task 1:
 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_slab_alloc+0xb1/0xe0 mm/kasan/common.c:463
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960
 kmem_cache_zalloc include/linux/slab.h:654 [inline]
 acpi_os_acquire_object include/acpi/platform/aclinuxex.h:67 [inline]
 acpi_ut_allocate_object_desc_dbg drivers/acpi/acpica/utobject.c:359 [inline]
 acpi_ut_create_internal_object_dbg+0x251/0x4f0 drivers/acpi/acpica/utobject.c:84
 acpi_ds_create_buffer_field+0x3a5/0x620 drivers/acpi/acpica/dsfield.c:214
 acpi_ds_load2_end_op+0x4da/0xf10 drivers/acpi/acpica/dswload2.c:475
 acpi_ds_exec_end_op+0x563/0x1190 drivers/acpi/acpica/dswexec.c:540
 acpi_ps_parse_loop+0xda4/0x1c10 drivers/acpi/acpica/psloop.c:526
 acpi_ps_parse_aml+0x20e/0x9a0 drivers/acpi/acpica/psparse.c:475
 acpi_ps_execute_method+0x71d/0x850 drivers/acpi/acpica/psxface.c:190
 acpi_ns_evaluate+0x606/0x9d0 drivers/acpi/acpica/nseval.c:205
 acpi_ut_evaluate_object+0x150/0x490 drivers/acpi/acpica/uteval.c:60
 acpi_rs_get_method_data+0xb0/0x150 drivers/acpi/acpica/rsutils.c:650
 acpi_walk_resources+0x17f/0x590 drivers/acpi/acpica/rsxface.c:616
 try_get_root_bridge_busnr drivers/acpi/pci_root.c:110 [inline]
 acpi_pci_root_add+0x319/0x18c0 drivers/acpi/pci_root.c:552
 acpi_scan_attach_handler drivers/acpi/scan.c:1988 [inline]
 acpi_bus_attach+0x75f/0xc50 drivers/acpi/scan.c:2032
 acpi_bus_attach+0x240/0xc50 drivers/acpi/scan.c:2053
 acpi_bus_attach+0x240/0xc50 drivers/acpi/scan.c:2053
 acpi_bus_scan+0x104/0x150 drivers/acpi/scan.c:2105
 acpi_scan_init+0x261/0x80b drivers/acpi/scan.c:2270
 acpi_init+0x16f/0x222 drivers/acpi/bus.c:1257
 do_one_initcall+0x189/0x620 init/main.c:1197
 do_initcall_level+0x186/0x304 init/main.c:1270
 do_initcalls+0x4e/0x8e init/main.c:1286
 do_basic_setup+0x88/0x91 init/main.c:1306
 kernel_init_freeable+0x2be/0x3f5 init/main.c:1510
 kernel_init+0x11/0x280 init/main.c:1397
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff8881063b1000
 which belongs to the cache Acpi-Operand of size 72
The buggy address is located 0 bytes inside of
 72-byte region [ffff8881063b1000, ffff8881063b1048)
The buggy address belongs to the page:
page:ffffea000418ec40 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8881063b16e8 pfn:0x1063b1
flags: 0x4000000000000200(slab)
raw: 4000000000000200 ffffea000418e880 0000000500000005 ffff88810004db00
raw: ffff8881063b16e8 0000000080270000 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 1, ts 1132155231, 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]
 kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:2960
 kmem_cache_zalloc include/linux/slab.h:654 [inline]
 acpi_os_acquire_object include/acpi/platform/aclinuxex.h:67 [inline]
 acpi_ut_allocate_object_desc_dbg drivers/acpi/acpica/utobject.c:359 [inline]
 acpi_ut_create_internal_object_dbg+0x251/0x4f0 drivers/acpi/acpica/utobject.c:84
 acpi_ds_create_buffer_field+0x3a5/0x620 drivers/acpi/acpica/dsfield.c:214
 acpi_ds_load2_end_op+0x4da/0xf10 drivers/acpi/acpica/dswload2.c:475
 acpi_ds_exec_end_op+0x563/0x1190 drivers/acpi/acpica/dswexec.c:540
 acpi_ps_parse_loop+0xda4/0x1c10 drivers/acpi/acpica/psloop.c:526
 acpi_ps_parse_aml+0x20e/0x9a0 drivers/acpi/acpica/psparse.c:475
 acpi_ps_execute_method+0x71d/0x850 drivers/acpi/acpica/psxface.c:190
 acpi_ns_evaluate+0x606/0x9d0 drivers/acpi/acpica/nseval.c:205
 acpi_ut_evaluate_object+0x150/0x490 drivers/acpi/acpica/uteval.c:60
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881063b0f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881063b0f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881063b1000: fb fb fb fb fb fb fb fb fb fc fc fc fc fb fb fb
                   ^
 ffff8881063b1080: fb fb fb fb fb fb fc fc fc fc fb fb fb fb fb fb
 ffff8881063b1100: fb fb fb fc fc fc fc 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/09/06 02:57 android13-5.10-lts 1c5354a314ea 464ac2ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in __tlb_remove_page_size
* Struck through repros no longer work on HEAD.