[syzbot] [fs?] KASAN: use-after-free Read in sysv_new_inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

syzbot found the following issue on:

HEAD commit:    23e11d031852 Add linux-next specific files for 20240205
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11933ca8180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=6f1d38572a4a0540
dashboard link: https://syzkaller.appspot.com/bug?extid=2e64084fa0c65e8706c9
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b4e82c0f5cca/disk-23e11d03.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/018dac30c4d4/vmlinux-23e11d03.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ee21a2f37a73/bzImage-23e11d03.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2e64084fa0c65e8706c9@xxxxxxxxxxxxxxxxxxxxxxxxx

==================================================================
BUG: KASAN: use-after-free in sysv_new_inode+0xfdd/0x1170 fs/sysv/ialloc.c:153
Read of size 2 at addr ffff88803b1f61ce by task syz-executor.4/7277

CPU: 1 PID: 7277 Comm: syz-executor.4 Not tainted 6.8.0-rc3-next-20240205-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 sysv_new_inode+0xfdd/0x1170 fs/sysv/ialloc.c:153
 sysv_mknod+0x4e/0xe0 fs/sysv/namei.c:53
 lookup_open fs/namei.c:3494 [inline]
 open_last_lookups fs/namei.c:3563 [inline]
 path_openat+0x1425/0x3240 fs/namei.c:3793
 do_filp_open+0x235/0x490 fs/namei.c:3823
 do_sys_openat2+0x13e/0x1d0 fs/open.c:1404
 do_sys_open fs/open.c:1419 [inline]
 __do_sys_openat fs/open.c:1435 [inline]
 __se_sys_openat fs/open.c:1430 [inline]
 __x64_sys_openat+0x247/0x2a0 fs/open.c:1430
 do_syscall_64+0xfb/0x240
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f86a7c7dda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f86a8a900c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f86a7dabf80 RCX: 00007f86a7c7dda9
RDX: 000000000000275a RSI: 0000000020000040 RDI: ffffffffffffff9c
RBP: 00007f86a7cca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f86a7dabf80 R15: 00007fff47892ea8
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0000ec7d80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x3b1f6
flags: 0xfff80000000000(node=0|zone=1|lastcpupid=0xfff)
page_type: 0xffffffff()
raw: 00fff80000000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x141cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_WRITE), pid 16881, tgid 16881 (syz-executor.3), ts 1415422682739, free_ts 1421164748730
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1539
 prep_new_page mm/page_alloc.c:1546 [inline]
 get_page_from_freelist+0x34eb/0x3680 mm/page_alloc.c:3353
 __alloc_pages+0x256/0x680 mm/page_alloc.c:4609
 alloc_pages_mpol+0x3e8/0x680 mm/mempolicy.c:2263
 alloc_pages mm/mempolicy.c:2334 [inline]
 folio_alloc+0x12b/0x330 mm/mempolicy.c:2341
 filemap_alloc_folio+0xdf/0x500 mm/filemap.c:975
 __filemap_get_folio+0x431/0xbc0 mm/filemap.c:1919
 ext4_da_write_begin+0x5b9/0xa50 fs/ext4/inode.c:2885
 generic_perform_write+0x322/0x640 mm/filemap.c:3921
 ext4_buffered_write_iter+0xc6/0x350 fs/ext4/file.c:299
 ext4_file_write_iter+0x1de/0x1a10
 __kernel_write_iter+0x435/0x8c0 fs/read_write.c:523
 dump_emit_page fs/coredump.c:888 [inline]
 dump_user_range+0x46d/0x910 fs/coredump.c:915
 elf_core_dump+0x3d5e/0x4630 fs/binfmt_elf.c:2077
 do_coredump+0x1bab/0x2b50 fs/coredump.c:764
 get_signal+0x146b/0x1850 kernel/signal.c:2882
page last free pid 16881 tgid 16881 stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1140 [inline]
 free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2388
 free_unref_page_list+0x5a3/0x850 mm/page_alloc.c:2574
 release_pages+0x2744/0x2a80 mm/swap.c:1042
 __folio_batch_release+0x84/0x100 mm/swap.c:1062
 folio_batch_release include/linux/pagevec.h:83 [inline]
 truncate_inode_pages_range+0x457/0xf70 mm/truncate.c:362
 ext4_evict_inode+0x21c/0xf30 fs/ext4/inode.c:193
 evict+0x2a8/0x630 fs/inode.c:666
 __dentry_kill+0x20d/0x630 fs/dcache.c:603
 dput+0x19f/0x2b0 fs/dcache.c:845
 __fput+0x678/0x8a0 fs/file_table.c:384
 task_work_run+0x24f/0x310 kernel/task_work.c:180
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xa1b/0x27e0 kernel/exit.c:878
 do_group_exit+0x207/0x2c0 kernel/exit.c:1027
 get_signal+0x176e/0x1850 kernel/signal.c:2896
 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop kernel/entry/common.c:105 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 irqentry_exit_to_user_mode+0x79/0x280 kernel/entry/common.c:225

Memory state around the buggy address:
 ffff88803b1f6080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88803b1f6100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88803b1f6180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                              ^
 ffff88803b1f6200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88803b1f6280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux