Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp984516imi; Fri, 22 Jul 2022 14:14:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ttFFnl/v1HGgOQPO5lZDoriWQ5RhYT5GGjRrarE33LRDAr8lCwx4nDwGQfeYzcHhRr8eFt X-Received: by 2002:a17:906:93ef:b0:72b:3e88:a47 with SMTP id yl15-20020a17090693ef00b0072b3e880a47mr1359227ejb.706.1658524457852; Fri, 22 Jul 2022 14:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658524457; cv=none; d=google.com; s=arc-20160816; b=U32QY5TcB4zc+B48Msdowg+8A6jOERQBDDOkM/IZAS8fgwOkMb1ao53OAiKNZyMRPh cNszArWuR+WL19TKi0uPfrtUlMC2yVVSmhxxPBrSKPWUC3PAQyC8iI8SJQeVnyASntBt OkjbXa+e5N4XgDnulc32DWUb2MVG82r6UmsuUq7hBYKW2VNfefLd+VLZbeGZ5otirvPI i9sGRpSrpAz7SOPuSPdrrsH21hXdb5j1lJPKIn84GUxsV5Qu9+No2xceoAVOOS7RuWn+ HEEL8Wm7sI8gR9+h+6uRjABfUSkzLmqRP3RjEuvkVKpzzJggiO8LOdupuJTXpwLPDs7S QRHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=7kAaiP6aRNtfZL0vbTnM6otziHNfeXxPpMIn5XWR8Uo=; b=WGTxWz6o4xgvpb08Fs0CKJpWOOaol1VbUPCxjn+eai/7/ONpNMB3fA1H9gsqAC8qQG SkO4JtM1HfNLgzVD68zvkcPDCmSesvwmW700QvCrAn7uEUAbUVEy8kJaymM4S6rsIKQm pRjkdJYT8gQY3YSWicQ6EIwjcV/f2YFihxMw2t4GWCIRxG3BYyiByG9T+S0PP9jGFmGJ cU1Zly6Fsm/RCB1bgPBPn5vkBJVfJ1qjOK13vyIMKESzPCD3RAJ/DrOjv+ZyvvNCKm2x I4xL6WBZhIgIA+b44mJlrZzWiPXKMw5GjO+1q2C5nJ+uCcmxJzYvDc+ejrfRz6K7KwCf UI7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=acCoBp2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a056402518e00b0043ac5ba36easi7344073edd.419.2022.07.22.14.13.50; Fri, 22 Jul 2022 14:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=acCoBp2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233440AbiGVUwS (ORCPT + 99 others); Fri, 22 Jul 2022 16:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiGVUwQ (ORCPT ); Fri, 22 Jul 2022 16:52:16 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F77E61738; Fri, 22 Jul 2022 13:52:14 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id fy29so10422839ejc.12; Fri, 22 Jul 2022 13:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=7kAaiP6aRNtfZL0vbTnM6otziHNfeXxPpMIn5XWR8Uo=; b=acCoBp2+q1v+jnRU9z5bc8+5LKEYGXY7kFBLBno6mD804rpkGcRVB0AcWVL6oOLC70 u807TcSlkiiU/5f6i08lmBgiTi8v8rH1ua3AIlwbNdvIEdK41KYKBbheYgHJShO5SDVV 6xID+qEdettA6izrjglo9WaG20vxhoRjXwL2+bK2HcgvfhGsbs8qzliUiyHsn9YfzjIv 3FfxMMIlpJS23Wt11hAPI/IyI2EuXQjlDZk36xhmGNsfB6dn2GNhChBkt8DnESL09BfQ /XBk7Jy6lIsdKwGPhBhDa/pVvRYw1Nbj+/cGBZlSYP6JhtC3DUu3Fe5E8nLn8+juJ0+G I5tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=7kAaiP6aRNtfZL0vbTnM6otziHNfeXxPpMIn5XWR8Uo=; b=LEYuXhTyWp1hNbvIC914hHpRXhlPi9/RdjOdt2/Cu60kHkfYQAj6beX+EcF6HRtrXD 2IP0OpigrlnFTqGCWPkEpZPYZgFnggR3r/3w+3iOvDAjrodGnhQT2IohZn2TQJ7hEykj wFWAKhrAWKCAf4ss1TZjqZTCiwdSeykwZM8lK4qjhs1//fbPnwYWTJKR7dFj5uGiipg8 JjzpzQtkwHdFOxlgAs3SWmADmnwNqU+t8mc2k36+WlaW9Vzm14iGCXZh5OB7tiVNVqTf AQtnOaGUXqtNP4Ke1yRC5JHXkTiBVwBNWCbiscIdLQur3aMOy709CUO1ngLUlG//q8sO 1Atg== X-Gm-Message-State: AJIora9Ip0CXjvELxLTUVc9dkY5ha/rImFVAXhGE/ZDWUgvPisfK7BDO Bcrp5W+cI5hBRoWNEd6pPqCbIjSLt2Mf+uWCg14= X-Received: by 2002:a17:907:a056:b0:72b:1964:fbcc with SMTP id gz22-20020a170907a05600b0072b1964fbccmr1279571ejc.489.1658523132610; Fri, 22 Jul 2022 13:52:12 -0700 (PDT) MIME-Version: 1.0 From: Dipanjan Das Date: Fri, 22 Jul 2022 13:52:01 -0700 Message-ID: Subject: KASAN: use-after-free Read in reiserfs_fill_super To: Matthew Wilcox , damien.lemoal@opensource.wdc.com, jlayton@kernel.org, jack@suse.cz, edward.shishkin@gmail.com, reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: syzkaller@googlegroups.com, fleischermarius@googlemail.com, its.priyanka.bose@gmail.com Content-Type: multipart/mixed; boundary="0000000000002c0ea405e46b02c0" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000002c0ea405e46b02c0 Content-Type: text/plain; charset="UTF-8" Hi, We would like to report the following bug which has been found by our modified version of syzkaller. ====================================================== description: KASAN: use-after-free Read in reiserfs_fill_super affected file: fs/reiserfs/inode.c kernel version: 5.19-rc6 kernel commit: 32346491ddf24599decca06190ebca03ff9de7f8 git tree: upstream kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=cd73026ceaed1402 crash reproducer: attached ====================================================== Crash log: ====================================================== UG: KASAN: use-after-free in init_inode fs/reiserfs/inode.c:1325 [inline] BUG: KASAN: use-after-free in reiserfs_read_locked_inode+0x1f9c/0x2300 fs/reiserfs/inode.c:1574 Read of size 4 at addr ffff88819f38c000 by task syz-executor.5/13593 CPU: 0 PID: 13593 Comm: syz-executor.5 Tainted: G OE 5.19.0-rc6-g2eae0556bb9d #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:313 [inline] print_report.cold+0xe5/0x659 mm/kasan/report.c:429 kasan_report+0x8a/0x1b0 mm/kasan/report.c:491 init_inode fs/reiserfs/inode.c:1325 [inline] reiserfs_read_locked_inode+0x1f9c/0x2300 fs/reiserfs/inode.c:1574 reiserfs_fill_super+0x126c/0x2f10 fs/reiserfs/super.c:2073 mount_bdev+0x34d/0x410 fs/super.c:1367 legacy_get_tree+0x105/0x220 fs/fs_context.c:610 vfs_get_tree+0x89/0x2f0 fs/super.c:1497 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1228/0x1cb0 fs/namespace.c:3370 do_mount+0xf3/0x110 fs/namespace.c:3383 __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x18f/0x230 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7f4fe2e8fe8e Code: 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 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:00007f4fe148b9f8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 00007f4fe2e8fe8e RDX: 0000000020000040 RSI: 0000000020000100 RDI: 00007f4fe148ba50 RBP: 00007f4fe148ba90 R08: 00007f4fe148ba90 R09: 0000000020000040 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000040 R13: 0000000020000100 R14: 00007f4fe148ba50 R15: 0000000020011400 The buggy address belongs to the physical page: page:ffffea00067ce300 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x1 pfn:0x19f38c flags: 0x17ff00000000000(node=0|zone=2|lastcpupid=0x7ff) raw: 017ff00000000000 ffffea000610d9c8 ffffea0006897b08 0000000000000000 raw: 0000000000000001 0000000000000000 00000000ffffff7f 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 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 2972, tgid 2972 (systemd-udevd), ts 583268397100, free_ts 649857437696 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2449 [inline] prep_new_page+0x297/0x330 mm/page_alloc.c:2456 get_page_from_freelist+0x2142/0x3c80 mm/page_alloc.c:4198 __alloc_pages+0x321/0x710 mm/page_alloc.c:5426 __folio_alloc+0x12/0x40 mm/page_alloc.c:5457 vma_alloc_folio+0xf9/0x6e0 mm/mempolicy.c:2233 alloc_page_vma include/linux/gfp.h:634 [inline] wp_page_copy+0x1f1/0x1d00 mm/memory.c:3104 do_wp_page+0x52c/0x1840 mm/memory.c:3471 handle_pte_fault mm/memory.c:4921 [inline] __handle_mm_fault+0x2a69/0x3ee0 mm/memory.c:5042 handle_mm_fault+0x322/0xa80 mm/memory.c:5140 do_user_addr_fault+0x489/0x11c0 arch/x86/mm/fault.c:1397 handle_page_fault arch/x86/mm/fault.c:1484 [inline] exc_page_fault+0x9e/0x180 arch/x86/mm/fault.c:1540 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:570 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x51f/0xd00 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page_list+0x15a/0xe90 mm/page_alloc.c:3475 release_pages+0x10ea/0x2590 mm/swap.c:980 tlb_batch_pages_flush mm/mmu_gather.c:58 [inline] tlb_flush_mmu_free mm/mmu_gather.c:255 [inline] tlb_flush_mmu+0xef/0x690 mm/mmu_gather.c:262 tlb_finish_mmu+0x93/0x3c0 mm/mmu_gather.c:353 exit_mmap+0x1de/0x4b0 mm/mmap.c:3164 __mmput kernel/fork.c:1196 [inline] mmput+0x16b/0x430 kernel/fork.c:1217 exit_mm kernel/exit.c:511 [inline] do_exit+0xa33/0x2dd0 kernel/exit.c:784 do_group_exit+0xd2/0x2f0 kernel/exit.c:927 __do_sys_exit_group kernel/exit.c:938 [inline] __se_sys_exit_group kernel/exit.c:936 [inline] __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:936 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Memory state around the buggy address: ffff88819f38bf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88819f38bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88819f38c000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88819f38c080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88819f38c100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== -- Thanks and Regards, Dipanjan --0000000000002c0ea405e46b02c0 Content-Type: application/octet-stream; name="repro.syz" Content-Disposition: attachment; filename="repro.syz" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5wxrw1g1 c3l6X21vdW50X2ltYWdlJHJlaXNlcmZzKCYoMHg3ZjAwMDAwMDAwNDApLCAmKDB4N2YwMDAwMDAw MTAwKT0nLi9maWxlMFx4MDAnLCAweDAsIDB4MywgJigweDdmMDAwMDAwMDIwMCk9W3smKDB4N2Yw MDAwMDEwMDAwKT0iMDA0MDAwMDA2ODAyMDAwMDk3M2QwMDAwM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g5NjY3 MjYwNDBiMzFhYzdmNTRjOTdhNjcxYjUzZjk5OTBkYWMxMWYwNzliZGE0ZGI1N2M5M2ZhMTAxZDlk NTMzMTc0MGVmOWI5ZDY5YzMyOGEwZWFkZjI5YzhjNjNkZTI0OGM3OTU5MzI4MTUwZjE3YjljZjcy IiwgMHgxMzQsIDB4M2Q5NzAwMH1dLCAweDAsICYoMHg3ZjAwMDAwMTE0MDApKQo= --0000000000002c0ea405e46b02c0 Content-Type: text/x-csrc; charset="US-ASCII"; name="repro.c" Content-Disposition: attachment; filename="repro.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5wxrw150 Ly8gYXV0b2dlbmVyYXRlZCBieSBzeXprYWxsZXIgKGh0dHBzOi8vZ2l0aHViLmNvbS9nb29nbGUv c3l6a2FsbGVyKQoKI2RlZmluZSBfR05VX1NPVVJDRSAKCiNpbmNsdWRlIDxkaXJlbnQuaD4KI2lu Y2x1ZGUgPGVuZGlhbi5oPgojaW5jbHVkZSA8ZXJybm8uaD4KI2luY2x1ZGUgPGZjbnRsLmg+CiNp bmNsdWRlIDxzaWduYWwuaD4KI2luY2x1ZGUgPHN0ZGFyZy5oPgojaW5jbHVkZSA8c3RkYm9vbC5o PgojaW5jbHVkZSA8c3RkZGVmLmg+CiNpbmNsdWRlIDxzdGRpbnQuaD4KI2luY2x1ZGUgPHN0ZGlv Lmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8c3lz L2lvY3RsLmg+CiNpbmNsdWRlIDxzeXMvbW91bnQuaD4KI2luY2x1ZGUgPHN5cy9wcmN0bC5oPgoj aW5jbHVkZSA8c3lzL3N0YXQuaD4KI2luY2x1ZGUgPHN5cy9zeXNjYWxsLmg+CiNpbmNsdWRlIDxz eXMvdHlwZXMuaD4KI2luY2x1ZGUgPHN5cy93YWl0Lmg+CiNpbmNsdWRlIDx0aW1lLmg+CiNpbmNs dWRlIDx1bml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