KASAN: use-after-free Write in paging64_update_accessed_dirty_bits

Status: auto-closed as invalid on 2021/09/01 08:03
First crash: 1078d, last: 1078d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Write in paging64_update_accessed_dirty_bits C error 16 783d 892d 2/2 fixed on 2022/04/21 04:24
android-54 KASAN: use-after-free Write in paging64_update_accessed_dirty_bits (2) 1 930d 930d 0/2 auto-closed as invalid on 2022/01/27 12:44

Sample crash report:
BUG: KASAN: use-after-free in paging64_cmpxchg_gpte arch/x86/kvm/paging_tmpl.h:166 [inline]
BUG: KASAN: use-after-free in paging64_update_accessed_dirty_bits+0x5b9/0x9d0 arch/x86/kvm/paging_tmpl.h:272
Write of size 8 at addr ffff888010001000 by task syz-executor.2/2882

CPU: 0 PID: 2882 Comm: syz-executor.2 Not tainted 5.4.116-syzkaller-00428-g546a6e8726bc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x24e lib/dump_stack.c:118
 print_address_description+0x9b/0x650 mm/kasan/report.c:384
 __kasan_report+0x182/0x260 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:641
 check_memory_region_inline mm/kasan/generic.c:141 [inline]
 check_memory_region+0x2a5/0x2e0 mm/kasan/generic.c:191
 paging64_cmpxchg_gpte arch/x86/kvm/paging_tmpl.h:166 [inline]
 paging64_update_accessed_dirty_bits+0x5b9/0x9d0 arch/x86/kvm/paging_tmpl.h:272
 paging64_walk_addr_generic+0xd6d/0x16d0 arch/x86/kvm/paging_tmpl.h:445
 paging64_walk_addr arch/x86/kvm/paging_tmpl.h:502 [inline]
 paging64_gva_to_gpa+0xd0/0x1a0 arch/x86/kvm/paging_tmpl.h:957
 kvm_write_guest_virt_helper arch/x86/kvm/x86.c:5512 [inline]
 emulator_write_std+0x117/0x1f0 arch/x86/kvm/x86.c:5545
 linear_write_system arch/x86/kvm/emulate.c:842 [inline]
 write_segment_descriptor arch/x86/kvm/emulate.c:1634 [inline]
 __load_segment_descriptor+0xfd1/0x1560 arch/x86/kvm/emulate.c:1789
 em_jmp_far+0x154/0x4d0 arch/x86/kvm/emulate.c:2231
 x86_emulate_insn+0x1037/0x6200 arch/x86/kvm/emulate.c:5718
 x86_emulate_instruction+0xc6b/0x2a30 arch/x86/kvm/x86.c:6811
 vcpu_enter_guest+0x28c2/0x3ea0 arch/x86/kvm/x86.c:8349
 vcpu_run+0x344/0xc00 arch/x86/kvm/x86.c:8413
 kvm_arch_vcpu_ioctl_run+0x463/0x950 arch/x86/kvm/x86.c:8635
 kvm_vcpu_ioctl+0x812/0xdc0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2930
 do_vfs_ioctl+0x76a/0x1720 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/0x1e0 arch/x86/entry/common.c:290
RIP: 0033:0x4665f9
Code: ff ff c3 66 2e 0f 1f 84 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa7f4336188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 00000000004665f9
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 00000000004bfce1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60
R13: 00007ffc371de25f R14: 00007fa7f4336300 R15: 0000000000022000

The buggy address belongs to the page:
page:ffffea0000400040 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x4000000000000000()
raw: 4000000000000000 ffffea0000400048 ffffea0000400048 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888010000f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888010000f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888010001000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888010001080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888010001100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/05/04 08:03 android12-5.4 546a6e8726bc 09efdd63 .config console log report info ci2-android-5-4-kasan KASAN: use-after-free Write in paging64_update_accessed_dirty_bits
* Struck through repros no longer work on HEAD.