From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail115-76.sinamail.sina.com.cn (mail115-76.sinamail.sina.com.cn [218.30.115.76]) (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 0FF213D69 for ; Sat, 28 Dec 2024 07:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735372484; cv=none; b=jmUQZBF4S8MEXOZKTC+hUG1EnYIDD1dwjdjY1gODrVzSTTDZZ8cbaAb09Vw5hqH/wYpwLo1kmOIsWURAX7foarTodrVEstmANsKvXbWbUioNXIDQYF2m6DZoApsrCBQUOwyFVQ5vE9uRYsrddwU4oV7Fo3Fd8ztSkl5jRd5MhAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735372484; c=relaxed/simple; bh=QW0gKYK0w6XQqBmxfUdhE7GmQ7rlJB7L58Y9HsQIVGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rx+mJ4j7KJ7/FZ43HnpCQfSyM3dX3C/Ihhv8h3CNVxFZr3VrfSDCMCNYSFoIsn6u2nrCYRXn1ANkzVrJcBQP2F0qkWOy6urWAKsrKetIL1+9ytjiVNIq7lkEXVqZpZzM6rmJTR3sahlrppmpV9dlilUCLQ3FZTjHUkddGIN1coM= 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.76 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.22) with ESMTP id 676FAEB50000131B; Sat, 28 Dec 2024 15:54:31 +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: 2700607602708 X-SMAIL-UIID: CEE34E2CE91B4C409E399171CCE0974A-20241228-155431-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 15:54:26 +0800 Message-ID: <20241228075430.555-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 @@ -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: --