From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DC33826158C; Thu, 23 Oct 2025 20:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761252571; cv=none; b=UI8KrFeoNUxGC3H7+xxdZFZsCHx/8L70QHJkv1TwQB3MbBBDqKuzuA3UQ/WbIZe2dxkvUe3Gad3uIG80A8At+TXi9OVb4HiAXp22FfE0AI+apXF3YYKIE6wkppMGqcHvznGRDg3LGjrXqyGC24+d2WyL0sxtlfdk7C7aSyge50I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761252571; c=relaxed/simple; bh=Zw7HUoU/mxy6anYY+mNGF83QxOEilwzO+J/cvE9hvo4=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=c/QCYd8LuZOJ5G1kCZj0pSZFJknwvZJIqNQqVfVTof4mbtQqVTGHxf/bKjo0bVq7fGwjFVtFQ6jeh+DceDIdJkWhCvC0tSTXgmKSAti54fZIgZUSqnolaGvSLWWJRnlXIUkybdn0U4zlmQpciutivIapzocIOf6xl/QKooJzMQ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=N2obuoXM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="N2obuoXM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B691EC4CEE7; Thu, 23 Oct 2025 20:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1761252570; bh=Zw7HUoU/mxy6anYY+mNGF83QxOEilwzO+J/cvE9hvo4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=N2obuoXM9Upw3c9OeUsYyJNs0Wk4sPv787zfdDZnSst/fqNqtgiC914hOUgO0a7Dh wRl85JFjBtECY82WuxEi0OSdiiYllkoB7AWvjI2QpVrHGLkVAgPK9prcwDiXMbOGNX YUMV0PUqlvq4DsU0o0g1qnlfIDYydyka3fnn11xg= Date: Thu, 23 Oct 2025 13:49:29 -0700 From: Andrew Morton To: Kiryl Shutsemau Cc: David Hildenbrand , Hugh Dickins , Matthew Wilcox , Alexander Viro , Christian Brauner , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Rik van Riel , Harry Yoo , Johannes Weiner , Shakeel Butt , Baolin Wang , "Darrick J. Wong" , Dave Chinner , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kiryl Shutsemau Subject: Re: [PATCHv2 1/2] mm/memory: Do not populate page table entries beyond i_size Message-Id: <20251023134929.b72ab75a8c132a17ae68a582@linux-foundation.org> In-Reply-To: <20251023093251.54146-2-kirill@shutemov.name> References: <20251023093251.54146-1-kirill@shutemov.name> <20251023093251.54146-2-kirill@shutemov.name> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 23 Oct 2025 10:32:50 +0100 Kiryl Shutsemau wrote: > From: Kiryl Shutsemau > > Accesses within VMA, but beyond i_size rounded up to PAGE_SIZE are > supposed to generate SIGBUS. > > Recent changes attempted to fault in full folio where possible. They did > not respect i_size, which led to populating PTEs beyond i_size and > breaking SIGBUS semantics. > > Darrick reported generic/749 breakage because of this. > > However, the problem existed before the recent changes. With huge=always > tmpfs, any write to a file leads to PMD-size allocation. Following the > fault-in of the folio will install PMD mapping regardless of i_size. > > Fix filemap_map_pages() and finish_fault() to not install: > - PTEs beyond i_size; > - PMD mappings across i_size; > > Signed-off-by: Kiryl Shutsemau > Fixes: 19773df031bc ("mm/fault: try to map the entire file folio in finish_fault()") Sep 28 2025 > Fixes: 357b92761d94 ("mm/filemap: map entire large folio faultaround") Sep 28 2025 > Fixes: 800d8c63b2e9 ("shmem: add huge pages support") Jul 26 2016 eek, what's this one doing here? Are we asking -stable maintainers to backport this patch into nine years worth of kernels? I'll remove this Fixes: line for now...