syzbot


KASAN: use-after-free Write in put_files_struct

Status: auto-closed as invalid on 2022/05/10 01:51
Reported-by: syzbot+beb477b6a7657361bdd0@syzkaller.appspotmail.com
First crash: 1059d, last: 1059d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: unable to handle kernel paging request in put_files_struct fs 1 193d 189d 0/28 auto-obsoleted due to no activity on 2024/08/23 03:25
linux-4.19 general protection fault in put_files_struct 1 1350d 1350d 0/1 auto-closed as invalid on 2021/07/22 09:06

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline]
BUG: KASAN: use-after-free in put_files_struct+0x23/0x350 fs/file.c:415
Write of size 4 at addr ffff8880001220c0 by task syz-executor.2/26832

CPU: 1 PID: 26832 Comm: syz-executor.2 Not tainted 4.19.211-syzkaller #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+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report+0x8f/0xa0 mm/kasan/report.c:412
 atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline]
 put_files_struct+0x23/0x350 fs/file.c:415
 exit_files+0x7e/0xa0 fs/file.c:445
 do_exit+0xbb9/0x2be0 kernel/exit.c:865
 do_group_exit+0x125/0x310 kernel/exit.c:967
 get_signal+0x3f2/0x1f70 kernel/signal.c:2589
 do_signal+0x8f/0x1670 arch/x86/kernel/signal.c:799
 exit_to_usermode_loop+0x204/0x2a0 arch/x86/entry/common.c:163
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fd8d23ade99
Code: Bad RIP value.
RSP: 002b:00007fd8d0d23218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007fd8d24c0f68 RCX: 00007fd8d23ade99
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007fd8d24c0f68
RBP: 00007fd8d24c0f60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd8d24c0f6c
R13: 00007ffefec60edf R14: 00007fd8d0d23300 R15: 0000000000022000

Allocated by task 8127:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 dup_fd+0x85/0xbf0 fs/file.c:280
 copy_files kernel/fork.c:1391 [inline]
 copy_process.part.0+0x1e75/0x8260 kernel/fork.c:1901
 copy_process kernel/fork.c:1710 [inline]
 _do_fork+0x22f/0xf30 kernel/fork.c:2219
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 26836:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 put_files_struct fs/file.c:421 [inline]
 put_files_struct+0x2c8/0x350 fs/file.c:413
 exit_files+0x7e/0xa0 fs/file.c:445
 do_exit+0xbb9/0x2be0 kernel/exit.c:865
 do_group_exit+0x125/0x310 kernel/exit.c:967
 get_signal+0x3f2/0x1f70 kernel/signal.c:2589
 do_signal+0x8f/0x1670 arch/x86/kernel/signal.c:799
 exit_to_usermode_loop+0x204/0x2a0 arch/x86/entry/common.c:163
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880001220c0
 which belongs to the cache files_cache of size 832
The buggy address is located 0 bytes inside of
 832-byte region [ffff8880001220c0, ffff888000122400)
The buggy address belongs to the page:
page:ffffea0000004880 count:1 mapcount:0 mapping:ffff88823b833ac0 index:0x0
IPVS: ftp: loaded support on port[0] = 21
flags: 0x7ff00000000100(slab)
raw: 007ff00000000100 ffffea0002923248 ffffea000292d288 ffff88823b833ac0
raw: 0000000000000000 ffff8880001220c0 0000000100000004 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888000121f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888000122000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888000122080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff888000122100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888000122180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
IPVS: ftp: loaded support on port[0] = 21
IPVS: ftp: loaded support on port[0] = 21

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/01/10 01:50 linux-4.19.y 3f8a27f9e27b 2ca0d385 .config console log report info ci2-linux-4-19 KASAN: use-after-free Write in put_files_struct
* Struck through repros no longer work on HEAD.