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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08C23C433FE for ; Sat, 8 Oct 2022 18:49:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 069AD6B0072; Sat, 8 Oct 2022 14:49:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F33EF6B0073; Sat, 8 Oct 2022 14:49:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAD596B0074; Sat, 8 Oct 2022 14:49:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B72436B0072 for ; Sat, 8 Oct 2022 14:49:44 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7EA651A01D2 for ; Sat, 8 Oct 2022 18:49:44 +0000 (UTC) X-FDA: 79998671088.09.04ED86C Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by imf21.hostedemail.com (Postfix) with ESMTP id 1B8141C0014 for ; Sat, 8 Oct 2022 18:49:43 +0000 (UTC) Received: by mail-il1-f198.google.com with SMTP id r12-20020a92cd8c000000b002f9f5baaeeaso6098347ilb.4 for ; Sat, 08 Oct 2022 11:49:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YcqWwSGyuKcP0gRQSxDj0dKfGmYywAMKGeArDXcx+a8=; b=71m9wMc9bpljXcYxUvhD0z2Pd/u8vRPYQKpWsSo3aI79nZ9FoagLxUFuHEZv5nIYn4 r7ZuEOqHOoBvLorBtyrvCJKgS1Uxlqs05XsTOXl1Q/ALWKsAlIUAgx9TfYSsiwluu0bq VsHzFWRl2a6MiCtEwOXy3zL5FeLl9SqT4faosjxf247LeJLUL45LWNWIddVdUf6F9/hc RQEUavSUm+xT2z37zUqk1Wmtwie+nYduNVrIlL+6D70O5I8eRBLPAnwy4VvWgaLpFI/Y KSZboPrQqloyGRGWBe+OeBxtpblvNQaa9Voy0CCe35wZqkD74yGn+IgOX1Fqu8uhfCao 5nvA== X-Gm-Message-State: ACrzQf2OtV39nHi2Tc1SNPkeQ4DGEado0c7AOkt54tYdhpAeNv0dF1p7 2zbcvSpOclflptiGULRDd5vn4GRwTgT6LRjFHkIf/RAeSJQJ X-Google-Smtp-Source: AMsMyM7k1jTeuoq6HffXhpaTygK/em9ZhFatB+H2Dyw1cP8oizSiLz2GDLUifXiInppHRvvPxAPKYsuwsg8GN6rpkd4tFkb5By0d MIME-Version: 1.0 X-Received: by 2002:a05:6638:13ca:b0:35a:7ece:3c6a with SMTP id i10-20020a05663813ca00b0035a7ece3c6amr5515228jaj.318.1665254983478; Sat, 08 Oct 2022 11:49:43 -0700 (PDT) Date: Sat, 08 Oct 2022 11:49:43 -0700 In-Reply-To: <000000000000117c7505e7927cb4@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000c032fc05ea8a6357@google.com> Subject: Re: [syzbot] UBSAN: array-index-out-of-bounds in truncate_inode_pages_range From: syzbot To: akpm@linux-foundation.org, dvyukov@google.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, willy@infradead.org Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665254984; a=rsa-sha256; cv=none; b=VFJ8VHiU+tMZX2nmhsiHKz95ICoPXh+Mxe50iqcBErtKnneQZcIgp8glQdx7Kob44Zcdgr +H1kd9j9ShqG1Pohmo6P8JbvPy4ccZlv44oSRMIUoF8pR0pKBBT3+BujG+BQWPuRB0Tb6O aVEaPdKaPOliT+YTasQjTVDaenbSfHY= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=appspotmail.com (policy=none); spf=pass (imf21.hostedemail.com: domain of 3R8ZBYwkbAPou01mcnngtcrrkf.iqqingwugteqpvgpv.eqo@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com designates 209.85.166.198 as permitted sender) smtp.mailfrom=3R8ZBYwkbAPou01mcnngtcrrkf.iqqingwugteqpvgpv.eqo@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665254984; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references; bh=YcqWwSGyuKcP0gRQSxDj0dKfGmYywAMKGeArDXcx+a8=; b=V98tH5PfWOAHIFqjugdH1DbKA7V/LYfgjWGNNRn5N8GZNckfZoz9s03Os8O6SAcmSPlM5W BQRvJHagA9DjylPiEGW0IiWG9KECrS3ZeG4hWBWBWAB1DQPRRXJmvDHfkpNY2O78vdLyFu vovVfrJlQ96Ri64A7BnziugxXhu0VAc= Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=appspotmail.com (policy=none); spf=pass (imf21.hostedemail.com: domain of 3R8ZBYwkbAPou01mcnngtcrrkf.iqqingwugteqpvgpv.eqo@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com designates 209.85.166.198 as permitted sender) smtp.mailfrom=3R8ZBYwkbAPou01mcnngtcrrkf.iqqingwugteqpvgpv.eqo@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com X-Stat-Signature: z6i3jzhbmxmyt6n89f3xnmibdk473tgz X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1B8141C0014 X-Rspam-User: X-HE-Tag: 1665254983-305269 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: syzbot has found a reproducer for the following issue on: HEAD commit: e8bc52cb8df8 Merge tag 'driver-core-6.1-rc1' of git://git... git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=11a70a42880000 kernel config: https://syzkaller.appspot.com/x/.config?x=7579993da6496f03 dashboard link: https://syzkaller.appspot.com/bug?extid=5867885efe39089b339b compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=153137b8880000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=123cae34880000 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/4dc25a89bfbd/disk-e8bc52cb.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/16c9ca5fd754/vmlinux-e8bc52cb.xz mounted in repro: https://storage.googleapis.com/syzbot-assets/f3507911193f/mount_0.gz IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+5867885efe39089b339b@syzkaller.appspotmail.com ntfs3: loop0: Different NTFS' sector size (1024) and media sector size (512) ================================================================== BUG: KASAN: out-of-bounds in folio_batch_count include/linux/pagevec.h:108 [inline] BUG: KASAN: out-of-bounds in truncate_inode_pages_range+0x512/0x17b0 mm/truncate.c:366 Read of size 1 at addr ffffc9000b40f8a0 by task syz-executor300/12162 CPU: 1 PID: 12162 Comm: syz-executor300 Not tainted 6.0.0-syzkaller-07994-ge8bc52cb8df8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x65/0x4b0 mm/kasan/report.c:317 print_report+0x108/0x220 mm/kasan/report.c:433 kasan_report+0xfb/0x130 mm/kasan/report.c:495 folio_batch_count include/linux/pagevec.h:108 [inline] truncate_inode_pages_range+0x512/0x17b0 mm/truncate.c:366 ntfs_evict_inode+0x18/0xb0 fs/ntfs3/inode.c:1741 evict+0x2a4/0x620 fs/inode.c:664 ntfs_fill_super+0x3c6c/0x4420 fs/ntfs3/super.c:1190 get_tree_bdev+0x400/0x620 fs/super.c:1323 vfs_get_tree+0x88/0x270 fs/super.c:1530 do_new_mount+0x289/0xad0 fs/namespace.c:3040 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x2e3/0x3d0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f1170f482fa Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 a8 00 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007f1170eee168 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f1170f482fa RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007f1170eee180 RBP: 0000000000000004 R08: 00007f1170eee1c0 R09: 00007f1170eee6b8 R10: 0000000000000000 R11: 0000000000000286 R12: 00007f1170eee1c0 R13: 0000000000000110 R14: 00007f1170eee180 R15: 0000000020001b80 The buggy address belongs to stack of task syz-executor300/12162 and is located at offset 32 in frame: truncate_inode_pages_range+0x0/0x17b0 This frame has 2 objects: [32, 160) 'fbatch' [192, 312) 'indices' The buggy address belongs to the virtual mapping at [ffffc9000b408000, ffffc9000b411000) created by: dup_task_struct+0x8b/0x490 kernel/fork.c:977 The buggy address belongs to the physical page: page:ffffea0001d7b300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x75ecc flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 12161, tgid 12161 (syz-executor300), ts 362387697256, free_ts 362353989799 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 vm_area_alloc_pages mm/vmalloc.c:2958 [inline] __vmalloc_area_node mm/vmalloc.c:3026 [inline] __vmalloc_node_range+0x8f4/0x1290 mm/vmalloc.c:3196 alloc_thread_stack_node+0x307/0x500 kernel/fork.c:312 dup_task_struct+0x8b/0x490 kernel/fork.c:977 copy_process+0x637/0x3f60 kernel/fork.c:2085 kernel_clone+0x22f/0x7a0 kernel/fork.c:2671 __do_sys_clone kernel/fork.c:2805 [inline] __se_sys_clone kernel/fork.c:2789 [inline] __x64_sys_clone+0x276/0x2e0 kernel/fork.c:2789 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 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:1449 [inline] free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x7d/0x630 mm/page_alloc.c:3476 mm_free_pgd kernel/fork.c:737 [inline] __mmdrop+0xae/0x3f0 kernel/fork.c:788 exit_mm+0x211/0x2f0 kernel/exit.c:510 do_exit+0x4e1/0x20a0 kernel/exit.c:782 do_group_exit+0x23b/0x2f0 kernel/exit.c:925 get_signal+0x172f/0x1780 kernel/signal.c:2857 arch_do_signal_or_restart+0x8d/0x750 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop+0x74/0x160 kernel/entry/common.c:166 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffffc9000b40f780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc9000b40f800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffffc9000b40f880: f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffffc9000b40f900: 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 ffffc9000b40f980: 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 00 00 00 00 ==================================================================