From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F20FC636CC for ; Tue, 31 Jan 2023 15:24:57 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pMsVE-0001jl-Kf; Tue, 31 Jan 2023 15:24:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from <3uDLZYwkbAKcZfgRHSSLYHWWPK.NVVNSLbZLYJVUaLUa.JVT@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com>) id 1pMsV8-0001jG-OJ for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Jan 2023 15:24:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:To:From:Subject:Message-ID:Date: MIME-Version:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/GzT8Ca9/sD3nYDS8TtqObVTP1MErstxT4+p3mDIIRI=; b=SWnSfjG6cevmOq7Vy7FDB+MOVH RyDB2AwZXPF2Ll6IFQvCcQeL/KtEjaOoEJwTDibOSaBPsz9R3kV6knwEKepfbKpg7U6QTkBoZpoX3 MriejvIr0BU1PvL0ANPRkdAIVL07rkVXSSJz7G+BQ8G0EBw6aOt6A3wx8xvqOGDZRhAg=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:To:From:Subject:Message-ID:Date:MIME-Version:Sender:Reply-To :Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=/GzT8Ca9/sD3nYDS8TtqObVTP1MErstxT4+p3mDIIRI=; b=K tyVF/1w+95oJVGYi5V19pqD9/oMXnszKEsj/5HK6REQ3esVW8JxMkEYL7dq8y9h/SaRTLYF19MNKi V8SWiAN5dKVxhip5KjpOJh0HJg4ofbi3zuo2KwkjMmNh+brNYqdK8+h6/EWHmHcldtIUjo8OaxDgs gjuoZMbf0oHd9GaU=; Received: from mail-io1-f71.google.com ([209.85.166.71]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1pMsV3-00073Y-1b for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Jan 2023 15:24:49 +0000 Received: by mail-io1-f71.google.com with SMTP id r25-20020a6bd919000000b0071cfef31f97so3160187ioc.4 for ; Tue, 31 Jan 2023 07:24:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:subject:message-id:date:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/GzT8Ca9/sD3nYDS8TtqObVTP1MErstxT4+p3mDIIRI=; b=gr0Luk1ElBKEE0Ptu43sL9ZffY20CBJX0YjPgYr3IdE9fqQfAJySsC53j1zsKrtgSR W08xEEGtGxbvdaf/eq6s8Yr5p5MqYfoocvtvlOOhfy4S/eNA3SN3ZwWE4XXFbvUPrXuv bBk/63cIfWP93jEFZbbq4FmeEbzg+EEyRgX3sDRReDfYDKBX+HiyP0AIDFzSMMzYlVFP DSRzhdYTDebUO+SnGlVvLzyhcURMWbMW6Q3VSY6aCzBY123cq3DmMsIn2rjIdNoE0NBp VJ5pOMw2c4SHofx8+eJtapWkSduD0z3i2BNVYP7tu8sAXuNRuQoLgl6SW5qhwV8ObnNt g5aA== X-Gm-Message-State: AFqh2kpXWuPZ6cBdBjMXE9O21lZF2Qn9NdqoDAUlMdeNNKr/TWAT+dTs sfqsyjDeDANQVQkmOlznlgIekI7C3Q45hKrwJkvCP5iHBRYF X-Google-Smtp-Source: AMrXdXtgzaWcC/0LwpfcOSRKR32P1nfEhyIyPUxLVUoJfjH8mh0nAv91cvviHAxXMsQqdXqNFH3GLIr7sT+YHyqx6cSi1Od7wX4U MIME-Version: 1.0 X-Received: by 2002:a05:6638:3b06:b0:38a:adeb:d4d1 with SMTP id bb6-20020a0566383b0600b0038aadebd4d1mr8349878jab.81.1675178680186; Tue, 31 Jan 2023 07:24:40 -0800 (PST) Date: Tue, 31 Jan 2023 07:24:40 -0800 X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <0000000000002b009605f390ee61@google.com> From: syzbot To: chao@kernel.org, jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com X-Headers-End: 1pMsV3-00073Y-1b Subject: [f2fs-dev] [syzbot] [f2fs?] KASAN: use-after-free Write in __attach_extent_node X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Hello, syzbot found the following issue on: HEAD commit: 7c46948a6e9c Merge tag 'fs.fuse.acl.v6.2-rc6' of git://git.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=13f04ecd480000 kernel config: https://syzkaller.appspot.com/x/.config?x=c8d5c2ee6c2bd4b8 dashboard link: https://syzkaller.appspot.com/bug?extid=a6054f41d1cf28996a7d compiler: Debian clang version 13.0.1-6~deb11u1, GNU ld (GNU Binutils for Debian) 2.35.2 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15d846f5480000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=177f1649480000 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/cc51645b6401/disk-7c46948a.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/be036b5604a3/vmlinux-7c46948a.xz kernel image: https://storage.googleapis.com/syzbot-assets/274f5abf2c8f/bzImage-7c46948a.xz mounted in repro: https://storage.googleapis.com/syzbot-assets/f8e3282fa048/mount_0.gz IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+a6054f41d1cf28996a7d@syzkaller.appspotmail.com ================================================================== BUG: KASAN: use-after-free in rb_link_node include/linux/rbtree.h:65 [inline] BUG: KASAN: use-after-free in __attach_extent_node+0x23d/0x480 fs/f2fs/extent_cache.c:372 Write of size 8 at addr ffff8880714514e8 by task syz-executor122/5273 CPU: 1 PID: 5273 Comm: syz-executor122 Not tainted 6.2.0-rc5-syzkaller-00047-g7c46948a6e9c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x290 lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:306 print_report+0x107/0x1f0 mm/kasan/report.c:417 kasan_report+0xcd/0x100 mm/kasan/report.c:517 rb_link_node include/linux/rbtree.h:65 [inline] __attach_extent_node+0x23d/0x480 fs/f2fs/extent_cache.c:372 __insert_extent_tree+0x25b/0x580 fs/f2fs/extent_cache.c:655 __update_extent_tree_range+0x15cf/0x1e00 fs/f2fs/extent_cache.c:795 __update_extent_cache fs/f2fs/extent_cache.c:962 [inline] f2fs_update_read_extent_cache+0x410/0x580 fs/f2fs/extent_cache.c:1052 f2fs_outplace_write_data+0x1e2/0x380 fs/f2fs/segment.c:3453 f2fs_do_write_data_page+0x122d/0x2570 fs/f2fs/data.c:2745 f2fs_write_single_data_page+0x1162/0x1c90 fs/f2fs/data.c:2863 f2fs_write_cache_pages+0xf6e/0x2330 fs/f2fs/data.c:3115 __f2fs_write_data_pages fs/f2fs/data.c:3265 [inline] f2fs_write_data_pages+0x7d2/0xc30 fs/f2fs/data.c:3292 do_writepages+0x3c3/0x680 mm/page-writeback.c:2581 filemap_fdatawrite_wbc+0x11e/0x170 mm/filemap.c:388 __filemap_fdatawrite_range mm/filemap.c:421 [inline] file_write_and_wait_range+0x219/0x320 mm/filemap.c:777 f2fs_do_sync_file+0x611/0x19f0 fs/f2fs/file.c:275 generic_write_sync include/linux/fs.h:2885 [inline] f2fs_file_write_iter+0x659/0x2400 fs/f2fs/file.c:4721 call_write_iter include/linux/fs.h:2189 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7dc/0xc50 fs/read_write.c:584 ksys_write+0x177/0x2a0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fbe7cc4e4a9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 18 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fbe7cbf12f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fbe7ccd1780 RCX: 00007fbe7cc4e4a9 RDX: 00000000000ffe00 RSI: 0000000020004200 RDI: 0000000000000004 RBP: 00007fbe7cc9daec R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 6974797a616c6f6e R13: 00007fbe7cc9d8e8 R14: 0030656c69662f2e R15: 00007fbe7ccd1788 Allocated by task 5273: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x3d/0x60 mm/kasan/common.c:52 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:761 [inline] slab_alloc_node mm/slub.c:3452 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x1b3/0x350 mm/slub.c:3476 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2796 [inline] f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2806 [inline] __grab_extent_tree+0x19b/0x420 fs/f2fs/extent_cache.c:423 f2fs_init_extent_tree+0x20c/0x450 fs/f2fs/extent_cache.c:533 f2fs_new_inode+0xd89/0x1060 fs/f2fs/namei.c:312 __f2fs_tmpfile+0xa5/0x380 fs/f2fs/namei.c:852 f2fs_ioc_start_atomic_write+0x3ec/0x970 fs/f2fs/file.c:2098 __f2fs_ioctl+0x137d/0xb540 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5278: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x3d/0x60 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:518 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] kmem_cache_free+0x94/0x1d0 mm/slub.c:3809 __destroy_extent_tree+0x6fa/0x880 fs/f2fs/extent_cache.c:1193 f2fs_destroy_extent_tree+0x13/0x20 fs/f2fs/extent_cache.c:1204 f2fs_evict_inode+0x324/0x1310 fs/f2fs/inode.c:789 evict+0x2a4/0x620 fs/inode.c:664 f2fs_abort_atomic_write+0xc7/0x410 fs/f2fs/segment.c:196 f2fs_ioc_abort_atomic_write fs/f2fs/file.c:2182 [inline] __f2fs_ioctl+0x3294/0xb540 fs/f2fs/file.c:4156 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff8880714514e0 which belongs to the cache f2fs_extent_tree of size 144 The buggy address is located 8 bytes inside of 144-byte region [ffff8880714514e0, ffff888071451570) The buggy address belongs to the physical page: page:ffffea0001c51440 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x71451 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffff88814662c8c0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080130013 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x112c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 5255, tgid 5254 (syz-executor122), ts 207313154622, free_ts 199367221676 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x742/0x7c0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 alloc_slab_page+0xbd/0x190 mm/slub.c:1851 allocate_slab+0x5e/0x3c0 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0x782/0xe20 mm/slub.c:3193 __slab_alloc mm/slub.c:3292 [inline] __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x268/0x350 mm/slub.c:3476 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2796 [inline] f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2806 [inline] __grab_extent_tree+0x19b/0x420 fs/f2fs/extent_cache.c:423 f2fs_init_extent_tree+0x20c/0x450 fs/f2fs/extent_cache.c:533 f2fs_new_inode+0xd89/0x1060 fs/f2fs/namei.c:312 __f2fs_tmpfile+0xa5/0x380 fs/f2fs/namei.c:852 f2fs_ioc_start_atomic_write+0x3ec/0x970 fs/f2fs/file.c:2098 __f2fs_ioctl+0x137d/0xb540 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x751/0x780 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page_list+0xb2/0x830 mm/page_alloc.c:3510 release_pages+0x233e/0x25e0 mm/swap.c:1076 __pagevec_release+0x7d/0xf0 mm/swap.c:1096 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] shmem_undo_range+0x6d0/0x1fe0 mm/shmem.c:947 shmem_truncate_range mm/shmem.c:1042 [inline] shmem_evict_inode+0x276/0xa10 mm/shmem.c:1151 evict+0x2a4/0x620 fs/inode.c:664 __dentry_kill+0x3b1/0x5b0 fs/dcache.c:607 dentry_kill+0xbb/0x290 dput+0x1f3/0x410 fs/dcache.c:913 __fput+0x5e4/0x880 fs/file_table.c:328 task_work_run+0x243/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:296 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 Memory state around the buggy address: ffff888071451380: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc ffff888071451400: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888071451480: 00 00 00 00 fc fc fc fc fc fc fc fc fa fb fb fb ^ ffff888071451500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc ffff888071451580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== --- 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@googlegroups.com. syzbot will keep track of this issue. See: https://goo.gl/tpsmEJ#status for how to communicate with syzbot. syzbot can test patches for this issue, for details see: https://goo.gl/tpsmEJ#testing-patches _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel