syzbot


KASAN: use-after-free Write in ex_handler_refcount

Status: upstream: reported syz repro on 2020/08/29 07:49
Reported-by: syzbot+21c6da0a2f3ee4be6339@syzkaller.appspotmail.com
First crash: 674d, last: 672d
similar bugs (5):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Write in ex_handler_refcount (2) 1 633d 633d 0/1 auto-closed as invalid on 2021/02/06 10:12
linux-4.14 KASAN: use-after-free Write in ex_handler_refcount C done 16 670d 879d 1/1 fixed on 2020/10/03 03:40
linux-4.14 KASAN: use-after-free Write in ex_handler_refcount (3) C 32 11d 499d 0/1 upstream: reported C repro on 2021/02/20 19:09
linux-4.19 KASAN: use-after-free Write in ex_handler_refcount (2) C error 32 11d 462d 0/1 upstream: reported C repro on 2021/03/29 13:41
linux-4.19 KASAN: use-after-free Write in ex_handler_refcount C done 11 670d 879d 1/1 fixed on 2020/10/02 13:00

Sample crash report:
BUG: KASAN: use-after-free in ex_handler_refcount+0x14b/0x170 arch/x86/mm/extable.c:57
Write of size 4 at addr ffff8881cf6ccb00 by task syz-executor.0/853

CPU: 1 PID: 853 Comm: syz-executor.0 Not tainted 5.4.61-syzkaller-00873-ge15cc541b749 #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+0x14a/0x1ce lib/dump_stack.c:118
 print_address_description+0x93/0x620 mm/kasan/report.c:374
 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
 kasan_report+0x36/0x60 mm/kasan/common.c:634
 ex_handler_refcount+0x14b/0x170 arch/x86/mm/extable.c:57
 fixup_exception+0x92/0xd0 arch/x86/mm/extable.c:228
 do_trap_no_signal arch/x86/kernel/traps.c:207 [inline]
 do_trap+0x148/0x340 arch/x86/kernel/traps.c:251
 do_error_trap arch/x86/kernel/traps.c:278 [inline]
 do_invalid_op+0xfb/0x110 arch/x86/kernel/traps.c:291
 invalid_op+0x1e/0x30 arch/x86/entry/entry_64.S:1029
RIP: 0010:csum_partial_copy_generic+0xa2e/0x3ed0
Code: 0f 0b 49 8d 0f 0f 0b 49 8d 4d f4 0f 0b 48 8d 4d 00 0f 0b 49 8d 0e 0f 0b 49 8d 0e 0f 0b 49 8d 0f 0f 0b 48 8d 08 0f 0b 49 8d 0f <0f> 0b 49 8d 8c 24 b0 00 00 00 0f 0b 48 8d 8b 94 00 00 00 0f 0b 48
RSP: 0018:ffff8881c8fdfe38 EFLAGS: 00010296
RAX: f66ac99689b7d400 RBX: ffff8881ced880c8 RCX: ffff8881cf6ccb00
RDX: dffffc0000000000 RSI: 0000000000000000 RDI: ffff8881cf6ccb08
RBP: dffffc0000000000 R08: 0000000000000010 R09: ffff8881c8fdfd80
R10: ffffed10391fbf95 R11: 0000000000000004 R12: ffff8881ced88000
R13: 1ffff1103b2fd800 R14: 00000000000e0003 R15: ffff8881cf6ccb00
 __fput+0x27d/0x6c0 fs/file_table.c:280
 task_work_run+0x176/0x1a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
 prepare_exit_to_usermode+0x286/0x2e0 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45d5b9
Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f9fcf524c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e9
RAX: 0000000000000000 RBX: 0000000000002ac0 RCX: 000000000045d5b9
RDX: 0000000000000004 RSI: 0000000000000001 RDI: 0000000000000005
RBP: 000000000118cf88 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020fe0ff4 R11: 0000000000000246 R12: 000000000118cf4c
R13: 00007ffd9090a75f R14: 00007f9fcf5259c0 R15: 000000000118cf4c

Allocated by task 853:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
 kmem_cache_alloc_trace+0xc3/0x280 mm/slub.c:2820
 kmalloc include/linux/slab.h:556 [inline]
 do_eventfd+0x81/0x250 fs/eventfd.c:418
 __do_sys_eventfd2 fs/eventfd.c:438 [inline]
 __se_sys_eventfd2 fs/eventfd.c:436 [inline]
 __x64_sys_eventfd2+0x56/0x60 fs/eventfd.c:436
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 851:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x181/0x230 mm/kasan/common.c:471
 slab_free_hook mm/slub.c:1443 [inline]
 slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1476
 slab_free mm/slub.c:3041 [inline]
 kfree+0x12b/0x600 mm/slub.c:4002
 eventfd_free_ctx fs/eventfd.c:94 [inline]
 eventfd_free fs/eventfd.c:101 [inline]
 kref_put include/linux/kref.h:65 [inline]
 eventfd_ctx_put fs/eventfd.c:113 [inline]
 eventfd_release+0xbb/0xe0 fs/eventfd.c:122
 __fput+0x27d/0x6c0 fs/file_table.c:280
 task_work_run+0x176/0x1a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
 prepare_exit_to_usermode+0x286/0x2e0 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881cf6ccb00
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8881cf6ccb00, ffff8881cf6ccb40)
The buggy address belongs to the page:
page:ffffea00073db300 refcount:1 mapcount:0 mapping:ffff8881da803180 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea00073deb40 0000000300000003 ffff8881da803180
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881cf6cca00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881cf6cca80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8881cf6ccb00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8881cf6ccb80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881cf6ccc00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-android-5-4-kasan 2020/08/31 05:58 https://android.googlesource.com/kernel/common android-5.4 e15cc541b749 d5a3ae1f .config log report syz
ci2-android-5-4-kasan 2020/08/29 08:01 https://android.googlesource.com/kernel/common android-5.4 34364883b1f7 d5a3ae1f .config log report syz
ci2-android-5-4-kasan 2020/08/31 05:40 https://android.googlesource.com/kernel/common android-5.4 e15cc541b749 d5a3ae1f .config log report
ci2-android-5-4-kasan 2020/08/29 07:48 https://android.googlesource.com/kernel/common android-5.4 34364883b1f7 d5a3ae1f .config log report