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 50110C433FE for ; Wed, 26 Oct 2022 16:18:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D19C58E0002; Wed, 26 Oct 2022 12:18:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA2928E0001; Wed, 26 Oct 2022 12:18:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B43C78E0002; Wed, 26 Oct 2022 12:18:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A13D18E0001 for ; Wed, 26 Oct 2022 12:18:05 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 50178140D1A for ; Wed, 26 Oct 2022 16:18:05 +0000 (UTC) X-FDA: 80063607330.11.8ABC770 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by imf02.hostedemail.com (Postfix) with ESMTP id EF7768003F for ; Wed, 26 Oct 2022 16:18:04 +0000 (UTC) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-12c8312131fso20718795fac.4 for ; Wed, 26 Oct 2022 09:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=8Rx7jRbeJFQQeY4CuX68l+sc3xlUHAWmS3stTUI4NW4=; b=tXTU3cd+Kem9VQGM9wx+izXfLuSE0e5vXjNSSlsAFVcNWvD6N++yblUw3Sj4lfIo1F Y2wEsaeDpdjPjfDnHhK7PvAhfBeRhP4zOJs55LyF1DqEVthK8F+3LZIca6N5UIxr4jDV CVE6muoI+bPlkye9/FKzzJPxFCEBlGMGeQ+HzGFQywzCXCFUjQC+PKi67pCkmeAxYImd 4c/PkkuLKsqjIJULeyNaiEaaaOMVpOsX8FZWQ3X/EXjD5/wn0SgWvyNm5yPT227gKQfs o2bxSVvBHqImSAWrwHfazOREziDKbg9IuXduyCL9l9fUPfB3ikDstfSKlBJsOiQuF82b cJfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8Rx7jRbeJFQQeY4CuX68l+sc3xlUHAWmS3stTUI4NW4=; b=k51S1FVxlXEGw4+Hmj9gKSxmLUDdpGaEFoNxYwyDbj4f5maSUvsyHhWswJBAjwU3mg 0Nn7dOU4oHWcW87tiPfPvu7okP8xaEtDlTbgYp5vpNs6hbglTUwXo6hf0MPUW/Oyb4zf u5dNOybwpNbMswcTGUCsdA4FepbipMUcP9oB06+4j4my5dm5Esr5wP0Mizk2ibq4Egh8 kf/Bs3/AQXKpK9p4JYgSwkuOQ3HL0imbkgjmcoLH0QE9m2MbZBr+OM2LSgrE6h7KW05L SwLUUfBjUrtyITsleJZEqKCS3IQee2ex2M46iCB2lsFbPQrbSTGXKMBfSi8d7+2aR7kR Fzpw== X-Gm-Message-State: ACrzQf1w15cQKnXxNoHma5BCKfdJ5ipqLlXwRulIjXgBoZIfZ+lxxfDG GQox8vKrGpK0U2VRW83v9UPbhA== X-Google-Smtp-Source: AMsMyM6M1iDV0OZbGMhwkNmiuLLXfbwMYg2h+5uP+hfUNLmpAFlxkFD9AwKteR1ZnqQkuEEucDL6ug== X-Received: by 2002:a05:6870:eaaa:b0:132:e501:4053 with SMTP id s42-20020a056870eaaa00b00132e5014053mr2732963oap.186.1666801083998; Wed, 26 Oct 2022 09:18:03 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id f11-20020a05680807cb00b003546cb60859sm2163458oij.14.2022.10.26.09.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 09:18:02 -0700 (PDT) Date: Wed, 26 Oct 2022 09:17:53 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: David Hildenbrand cc: Dmitry Vyukov , syzbot , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, Mel Gorman , Hugh Dickins Subject: Re: [syzbot] WARNING in __split_huge_page_tail In-Reply-To: Message-ID: References: <000000000000aa2b2805ebea9137@google.com> <9a450a11-531d-8e1a-4c77-70102aa7f424@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666801085; a=rsa-sha256; cv=none; b=XX6PJFTz3l6PrjMHvhBkt3ezIRGEQ3n6E/oD9HY+hE+5JetErdU7ek3o2D7sOVP4QFBWs9 jzuRNzB3NQFATuxN1kyj0xcLwQZByWu+MEZFb5eetCx5UYMKyKz+QoxxUV64PFNeI9hM2h +CeKF6opphaQPeoC6gXXnbspyJu1NKQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=tXTU3cd+; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of hughd@google.com designates 209.85.160.47 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666801085; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8Rx7jRbeJFQQeY4CuX68l+sc3xlUHAWmS3stTUI4NW4=; b=B2l9wEcXSY99757RXXZ1mGLsKDfJWoLLKQ3cV0wfIigtJfo8EHhw3iTsXOccpjhIwjkPpG hFGncSaUh9SV2kw0AHQDTUA+1Pdh3Ft8+WWO3n5hoks0C8NTpvoyo+ywSaNfnVUGrlvBIc jflVgqTMa8hSPoahsJioXU5eCt7YkvI= X-Rspamd-Queue-Id: EF7768003F Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=tXTU3cd+; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of hughd@google.com designates 209.85.160.47 as permitted sender) smtp.mailfrom=hughd@google.com X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: s8dg96bqfkhgxjigwqius49n7znx9krx X-HE-Tag: 1666801084-458604 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: On Wed, 26 Oct 2022, David Hildenbrand wrote: > On 26.10.22 15:25, Dmitry Vyukov wrote: > > On Wed, 26 Oct 2022 at 02:54, David Hildenbrand wrote: > >> On 26.10.22 08:59, syzbot wrote: > >>> Hello, > >>> > >>> syzbot found the following issue on: > >>> > >>> HEAD commit: 4da34b7d175d Merge tag 'thermal-6.1-rc2' of > >>> git://git.kern.. > >>> git tree: upstream > >>> console+strace: https://syzkaller.appspot.com/x/log.txt?x=113bd8bc880000 > >>> kernel config: https://syzkaller.appspot.com/x/.config?x=4789759e8a6d5f57 > >>> dashboard link: > >>> https://syzkaller.appspot.com/bug?extid=273b547b15eb58ea35e8 > >>> 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=161e1f62880000 > >>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16dd4fe6880000 > >>> > >>> Downloadable assets: > >>> disk image: > >>> https://storage.googleapis.com/syzbot-assets/a61ddb36c296/disk-4da34b7d.raw.xz > >>> vmlinux: > >>> https://storage.googleapis.com/syzbot-assets/ceee41246252/vmlinux-4da34b7d.xz > >>> > >>> IMPORTANT: if you fix the issue, please add the following tag to the > >>> commit: > >>> Reported-by: syzbot+273b547b15eb58ea35e8@syzkaller.appspotmail.com > >>> > >>> tlb_finish_mmu+0xcb/0x200 mm/mmu_gather.c:363 > >>> exit_mmap+0x2b1/0x670 mm/mmap.c:3098 > >>> __mmput+0x114/0x3b0 kernel/fork.c:1185 > >>> exit_mm+0x217/0x2f0 kernel/exit.c:516 > >>> do_exit+0x5e7/0x2070 kernel/exit.c:807 > >>> do_group_exit+0x1fd/0x2b0 kernel/exit.c:950 > >>> __do_sys_exit_group kernel/exit.c:961 [inline] > >>> __se_sys_exit_group kernel/exit.c:959 [inline] > >>> __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:959 > >>> 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 > >>> ------------[ cut here ]------------ > >>> WARNING: CPU: 0 PID: 3908 at mm/huge_memory.c:2465 > >>> __split_huge_page_tail+0x81c/0x1080 mm/huge_memory.c:2465 > >> > >> Is this the > >> > >> VM_BUG_ON_PAGE(atomic_read(&page_tail->_mapcount) != -1, page_tail); > >> > >> assertion? > > > > Hi David, > > > > You can check the sources for that revision, but on the dashboard > > there are clickable links for all source references: > > https://syzkaller.appspot.com/bug?extid=273b547b15eb58ea35e8 > > > > In this case it points to: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/huge_memory.c?id=4da34b7d175dc99b8befebd69e96546c960d526c#n2465 > > > > Ah, thanks! > > ... so > > if (!folio_test_swapcache(page_folio(head))) { > VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head); > page_tail->private = 0; > } > > I recall that there was a patch either from Hugh or Mel floating around that > might be related. Yes, it's in akpm's mm-hotfixes-unstable branch, currently at 826367c8c422 ("mm: prep_compound_tail() clear page->private") [PATCH] mm: prep_compound_tail() clear page->private Although page allocation always clears page->private in the first page or head page of an allocation, it has never made a point of clearing page->private in the tails (though 0 is often what is already there). But now commit 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") issues a warning when page_tail->private is found to be non-0 (unless it's swapcache). Change that warning to dump page_tail (which also dumps head), instead of just the head: so far we have seen dead000000000122, dead000000000003, dead000000000001 or 0000000000000002 in the raw output for tail private. We could just delete the warning, but today's consensus appears to want page->private to be 0, unless there's a good reason for it to be set: so now clear it in prep_compound_tail() (more general than just for THP; but not for high order allocation, which makes no pass down the tails). Fixes: 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") Signed-off-by: Hugh Dickins Cc: Mel Gorman Cc: Matthew Wilcox (Oracle) Cc: --- mm/huge_memory.c | 2 +- mm/page_alloc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 03fc7e5edf07..561a42567477 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2462,7 +2462,7 @@ static void __split_huge_page_tail(struct page *head, int tail, * Fix up and warn once if private is unexpectedly set. */ if (!folio_test_swapcache(page_folio(head))) { - VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head); + VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, page_tail); page_tail->private = 0; } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b5a6c815ae28..218b28ee49ed 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -807,6 +807,7 @@ static void prep_compound_tail(struct page *head, int tail_idx) p->mapping = TAIL_MAPPING; set_compound_head(p, head); + set_page_private(p, 0); } void prep_compound_page(struct page *page, unsigned int order) -- 2.35.3