From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail115-100.sinamail.sina.com.cn (mail115-100.sinamail.sina.com.cn [218.30.115.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05ECA13BC0E for ; Sat, 28 Dec 2024 10:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735382232; cv=none; b=ePzoYRGfBGTC3H001ByM3KpomEUZIZ5hyzaqkvreexgkLk2JfGCkGsGDSbbzdme7Vr+DLC0+S6vUSUdi5X5+GtrXbwMOR6CM7lo8juEhZFicdeEwca0TjtBd038C/p3f6sxP/WbS836kZyATup2x9siDIemjv3Q2XY49ZcmSyoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735382232; c=relaxed/simple; bh=U/utE62V+I0cquVAx1meC8gB56yJPeoHDZ7bRYPLjfQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VV9V8PXiX/CDbHm2nPQe6VbLqd2G7HT6FNbxVNpLNHXjp2LXijg8Ym0T1ki3FYNJ3czQ8OsETX7SFn4mdBGXthNrzIxDCbDcRvbytWYx98g7/tAjtLORrbodRiakrWvc05eF0OD5kiISy+csZT7k1iVFTxPEtJnHcX/pKAvO6DY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.88.50.127]) by sina.com (10.185.250.23) with ESMTP id 676FD4A900006DDA; Sat, 28 Dec 2024 18:36:28 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 5451908913297 X-SMAIL-UIID: 30F1EA4473414F28909FA03D009C82F0-20241228-183628-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [mm?] WARNING in __folio_rmap_sanity_checks (2) Date: Sat, 28 Dec 2024 18:36:26 +0800 Message-ID: <20241228103627.577-1-hdanton@sina.com> In-Reply-To: <676f84f5.050a0220.2f3838.0493.GAE@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, 27 Dec 2024 20:56:21 -0800 > syzbot has found a reproducer for the following issue on: > > HEAD commit: 8155b4ef3466 Add linux-next specific files for 20241220 > git tree: linux-next > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1652fadf980000 #syz test --- x/include/linux/rmap.h +++ y/include/linux/rmap.h @@ -195,7 +195,7 @@ enum rmap_level { }; static inline void __folio_rmap_sanity_checks(const struct folio *folio, - const struct page *page, int nr_pages, enum rmap_level level) + struct page *page, int nr_pages, enum rmap_level level) { /* hugetlb folios are handled separately. */ VM_WARN_ON_FOLIO(folio_test_hugetlb(folio), folio); @@ -213,8 +213,17 @@ static inline void __folio_rmap_sanity_c */ VM_WARN_ON_ONCE(nr_pages <= 0); - VM_WARN_ON_FOLIO(page_folio(page) != folio, folio); - VM_WARN_ON_FOLIO(page_folio(page + nr_pages - 1) != folio, folio); + if (!folio_test_large(folio)) { + VM_WARN_ON_FOLIO(page_folio(page) != folio, folio); + VM_WARN_ON_FOLIO(page_folio(page + nr_pages - 1) != folio, folio); + } else { + struct page *p = compound_head(page); + + VM_WARN_ON_FOLIO(page_folio(p) != folio, folio); + p = page + nr_pages - 1; + p = compound_head(p); + VM_WARN_ON_FOLIO(page_folio(p) != folio, folio); + } switch (level) { case RMAP_LEVEL_PTE: --