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 67522ECAAD5 for ; Fri, 9 Sep 2022 01:37:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CB9E8D0003; Thu, 8 Sep 2022 21:37:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8529D8D0001; Thu, 8 Sep 2022 21:37:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CCA78D0003; Thu, 8 Sep 2022 21:37:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 583BF8D0001 for ; Thu, 8 Sep 2022 21:37:31 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1F652AB014 for ; Fri, 9 Sep 2022 01:37:31 +0000 (UTC) X-FDA: 79890834702.03.6FACEE7 Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) by imf03.hostedemail.com (Postfix) with ESMTP id BA88120075 for ; Fri, 9 Sep 2022 01:37:30 +0000 (UTC) Received: by mail-il1-f200.google.com with SMTP id i27-20020a056e021d1b00b002eb5eb4d200so154147ila.21 for ; Thu, 08 Sep 2022 18:37:30 -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:date:mime-version:x-gm-message-state :from:to:cc:subject:date; bh=ZtHKZi9er1ZjEMUmn/+LwojDtY9MogZdu8h8D7swnmI=; b=Pvr8GoEUkNIfwXOd1l12jDZKapqsMEmTYmZbhbJUs4852OdHZ8krMYMiiBD83OyxXl iHntPl1osgTK10XrFS4SKhnSXTv+dK3vlKZViazeR7aTnt8XLv9MU2PfyYBpqisYnE7R h9SNdQVZ5/1TSOLEwsVEqy7UHUiVTCyDJsYBPlc7d9DBASMPAUlq6zxKACVvIe+SEMVh wdQLLXTN4Thr1HpGrrX0XzL7tzgjswzUXYTDowrdEWHGnETiFHQ33UxvChLAJkjAw7BW L7PKVvlhGIsO6n4sDFrcXYhLHesOY1RGsBOeb+Q/gx8nw0BW/hboOrzGfFl9y8eXgJwC lk6g== X-Gm-Message-State: ACgBeo1MTAVtPZxSUiSe4qLViid9MMmBw9Z/9AfurielIBdVhEGIHC6x HHsqalrXgGdEVnPoDkkja8Nd4ruVcLbX/fiHQWJRSzA+D4Xw X-Google-Smtp-Source: AA6agR7VqVqXT1uyKMf1Wg9Yx7cyTmPcI9kF+5ONziqWQcOIIKnQuWXhOCjGIgFuz88A8Jhm7aQPXN11KsY30JOzYiQIKOv7YZ6Y MIME-Version: 1.0 X-Received: by 2002:a05:6602:14c2:b0:67d:ae1:1c23 with SMTP id b2-20020a05660214c200b0067d0ae11c23mr5468038iow.212.1662687450094; Thu, 08 Sep 2022 18:37:30 -0700 (PDT) Date: Thu, 08 Sep 2022 18:37:30 -0700 X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000d5e00a05e834962e@google.com> Subject: [syzbot] KASAN: use-after-free Read in hugetlb_handle_userfault From: syzbot To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, llvm@lists.linux.dev, mike.kravetz@oracle.com, nathan@kernel.org, ndesaulniers@google.com, songmuchun@bytedance.com, syzkaller-bugs@googlegroups.com, trix@redhat.com Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662687450; a=rsa-sha256; cv=none; b=fUMq5+Aeba5zUVrhVB7QlUubxoAKIkLScifnMQ+SUjCWzdLY1qaFg7qUUwKmFmQipq7Cpr 8yxiQ9dPblvSeF2/XLN1UjXKzVGJXRiro3za125uhbxT9TcktDgqq2oADRAdcUL8SLKnUK NGeLeg5Jm4Y5uegVB+wTL0OiKVxuTu8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of 32pgaYwkbAJUHNO9zAA3GzEE72.5DD5A3JH3G1DCI3CI.1DB@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com designates 209.85.166.200 as permitted sender) smtp.mailfrom=32pgaYwkbAJUHNO9zAA3GzEE72.5DD5A3JH3G1DCI3CI.1DB@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=appspotmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662687450; 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: references; bh=ZtHKZi9er1ZjEMUmn/+LwojDtY9MogZdu8h8D7swnmI=; b=qJ7cjbOV/29/bCMDSR/TM20ZaOv848vAczk3OmFNaG9b55DF8vcBskMTgZCiHj5Fn2kf4S nNi2hl8jFNHgTEggxwBML8qr3+N2vMG7bKANw4U+GZh+YAHhwe8pxH0U19U7zx1oETUqCr znejl0s0gv2TALDyPVfDLs99TNNLFRs= Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of 32pgaYwkbAJUHNO9zAA3GzEE72.5DD5A3JH3G1DCI3CI.1DB@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com designates 209.85.166.200 as permitted sender) smtp.mailfrom=32pgaYwkbAJUHNO9zAA3GzEE72.5DD5A3JH3G1DCI3CI.1DB@M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=appspotmail.com (policy=none) X-Stat-Signature: gdrqiwhxq7ufxmate1m66g64bmwjf189 X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: BA88120075 X-HE-Tag: 1662687450-954439 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: Hello, syzbot found the following issue on: HEAD commit: 7726d4c3e60b Merge tag 'gpio-fixes-for-v6.0-rc4' of git://.. git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=1106f78b080000 kernel config: https://syzkaller.appspot.com/x/.config?x=892a57667b7af6cf dashboard link: https://syzkaller.appspot.com/bug?extid=193f9cee8638750b23cf compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16de5bc5080000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=120307e5080000 IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+193f9cee8638750b23cf@syzkaller.appspotmail.com ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3ee7/0x56d0 kernel/locking/lockdep.c:4923 Read of size 8 at addr ffff888017a60eb0 by task syz-executor225/3606 CPU: 0 PID: 3606 Comm: syz-executor225 Not tainted 6.0.0-rc3-syzkaller-00363-g7726d4c3e60b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 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:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495 __lock_acquire+0x3ee7/0x56d0 kernel/locking/lockdep.c:4923 lock_acquire kernel/locking/lockdep.c:5666 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631 down_read+0x98/0x450 kernel/locking/rwsem.c:1499 i_mmap_lock_read include/linux/fs.h:486 [inline] hugetlb_handle_userfault+0xf5/0x150 mm/hugetlb.c:5505 hugetlb_no_page mm/hugetlb.c:5554 [inline] hugetlb_fault+0x14cd/0x1aa0 mm/hugetlb.c:5778 handle_mm_fault+0x640/0x780 mm/memory.c:5149 do_user_addr_fault+0x475/0x1210 arch/x86/mm/fault.c:1397 handle_page_fault arch/x86/mm/fault.c:1488 [inline] exc_page_fault+0x94/0x170 arch/x86/mm/fault.c:1544 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x7f2ff2164c3b Code: 00 48 89 94 24 ca 03 00 00 f3 0f 6f 9c 24 c0 03 00 00 f3 0f 6f a4 24 d0 03 00 00 48 89 84 24 e2 03 00 00 48 8d 86 00 20 7a 20 <0f> 11 9e 00 20 7a 20 0f 11 a6 10 20 7a 20 48 8b b4 24 e0 03 00 00 RSP: 002b:00007f2ff2157820 EFLAGS: 00010246 RAX: 00000000207a5e00 RBX: 0000000000000000 RCX: 00180f8000180f80 RDX: 0002912000180f80 RSI: 0000000000003e00 RDI: 0000000000000008 RBP: 0000000000000006 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 00007f2ff2157c80 R12: 00000000207a2000 R13: 0000000000000000 R14: 0000000000000000 R15: 00007f2ff2157d80 Allocated by task 3606: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:470 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:727 [inline] slab_alloc_node mm/slub.c:3243 [inline] slab_alloc mm/slub.c:3251 [inline] __kmem_cache_alloc_lru mm/slub.c:3258 [inline] kmem_cache_alloc_lru+0x255/0x720 mm/slub.c:3275 alloc_inode_sb include/linux/fs.h:3103 [inline] hugetlbfs_alloc_inode+0x88/0x1e0 fs/hugetlbfs/inode.c:1121 alloc_inode+0x61/0x230 fs/inode.c:260 new_inode_pseudo fs/inode.c:1019 [inline] new_inode+0x27/0x270 fs/inode.c:1047 hugetlbfs_get_inode+0x353/0x5f0 fs/hugetlbfs/inode.c:844 hugetlb_file_setup+0x13a/0x590 fs/hugetlbfs/inode.c:1486 ksys_mmap_pgoff+0x184/0x5a0 mm/mmap.c:1578 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+0x63/0xcd Freed by task 0: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:367 [inline] ____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:329 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3534 [inline] kmem_cache_free+0xeb/0x5b0 mm/slub.c:3551 i_callback+0x3f/0x70 fs/inode.c:249 rcu_do_batch kernel/rcu/tree.c:2245 [inline] rcu_core+0x7b5/0x1890 kernel/rcu/tree.c:2505 __do_softirq+0x1d3/0x9c6 kernel/softirq.c:571 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:2793 destroy_inode+0x129/0x1b0 fs/inode.c:315 iput_final fs/inode.c:1748 [inline] iput.part.0+0x55d/0x810 fs/inode.c:1774 iput+0x58/0x70 fs/inode.c:1764 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401 __dentry_kill+0x3c0/0x640 fs/dcache.c:607 dentry_kill fs/dcache.c:733 [inline] dput+0x806/0xdb0 fs/dcache.c:913 __fput+0x39c/0x9d0 fs/file_table.c:333 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 ptrace_notify+0x114/0x140 kernel/signal.c:2353 ptrace_report_syscall include/linux/ptrace.h:420 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline] syscall_exit_work kernel/entry/common.c:249 [inline] syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276 __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline] syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888017a60ac0 which belongs to the cache hugetlbfs_inode_cache of size 1248 The buggy address is located 1008 bytes inside of 1248-byte region [ffff888017a60ac0, ffff888017a60fa0) The buggy address belongs to the physical page: page:ffffea00005e9800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17a60 head:ffffea00005e9800 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888145a66640 raw: 0000000000000000 0000000080170017 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 2981386393, free_ts 0 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5515 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2103 alloc_pages+0x22f/0x270 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x27e/0x3d0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x7f1/0xe10 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] __kmem_cache_alloc_lru mm/slub.c:3258 [inline] kmem_cache_alloc_lru+0x528/0x720 mm/slub.c:3275 alloc_inode_sb include/linux/fs.h:3103 [inline] hugetlbfs_alloc_inode+0x88/0x1e0 fs/hugetlbfs/inode.c:1121 alloc_inode+0x61/0x230 fs/inode.c:260 new_inode_pseudo fs/inode.c:1019 [inline] new_inode+0x27/0x270 fs/inode.c:1047 hugetlbfs_get_root fs/hugetlbfs/inode.c:803 [inline] hugetlbfs_fill_super+0x589/0xad0 fs/hugetlbfs/inode.c:1377 vfs_get_super fs/super.c:1168 [inline] get_tree_nodev+0xcd/0x1d0 fs/super.c:1198 hugetlbfs_get_tree fs/hugetlbfs/inode.c:1392 [inline] hugetlbfs_get_tree+0x1e3/0x2b0 fs/hugetlbfs/inode.c:1387 vfs_get_tree+0x89/0x2f0 fs/super.c:1530 fc_mount+0x13/0xc0 fs/namespace.c:1043 page_owner free stack trace missing Memory state around the buggy address: ffff888017a60d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888017a60e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888017a60e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888017a60f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888017a60f80: fb fb fb fb 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