From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.156 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796365224; b=cyiVpEnmEJNLCzVwSeNYaCCmabUMBTkoacc99YYmYgVFoECkL91fJhwTdx2rpzLpb60G dkKWNdQ9ywwg1edpWkwmlHvTi/nSG+g15DwDfDEa0CB7MlMXAHdDbcTLoxHsFQHxkwCWy 3zAOkYrYxbj9TBTC3mPHOBfjmQ1A0H8hEEQb8JcFTtRBQeAoWZXkn7fccJT+3y7RLp9wO a2sGnagVm9DgCZ3EpML3ii1r1lL4OtMV3W6uXD4MvXqKx3o9kpLq40lc+wRQpeqlVOdcH APKb5bADPLbTPMNY9klKKppuUO9O83+aai9yuY1XGMYxn9414PMTiyUZNA7bCM+VkXA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796365224; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Content-Type:Mime-Version:Subject:From: In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References: To:X-Mailer; bh=5FYs6GyXJjqSwIlG04aFvcvjaWhss6BlvR7YnE+i3yg=; b=Rs0wzIV1FMb6IJ0CdPEgdhDSuD9BjLZG3B/Wm/krD8BeRuz3lNL55/6k/Ev6FfFb5l70 u5eM+Zwid465HGAIqNCBAVRWcbEI//qlemd8l0QoCE8tRDU303Msvssmv/C9ieQa9vfMi ZBh8ipjcHOuxRG19JP8780M3ZGq7B8kxbp8hf2gp/o1wPivNPTGGn/qSdO1uZnJYjcC0L QYVae/QXi9zyb8oGqsFeOOf5CcMtXpi+E7VozjiqGMMSRNWwJFC8yq2pwAaiYXO9A7/Sc 3S+JUw+IwvFxxh1ouSh65KTFWO2+UxZ482OB82FCJ9deN1Ujl9Q6z/CKM6qtt3DA3ZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ioVm2LkY; arc=none smtp.remote-ip=91.218.175.156 Received: from mta0.migadu.com (out-156.mta0.migadu.com [91.218.175.156]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15D16606A322 for ; Fri, 4 Dec 2026 06:20:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 15D16606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ioVm2LkY X-Envelope-To: linux-doc@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=DsZUz25PMl6VQXyGHxuPiDhakrejakCFXpRTTBUVIc0=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796365221; v=1; x=1796970021; b=ioVm2LkY6OAZSzv8tcS+lNE0GXElcSSslVt3DIkmY2IcEF7To6LI6tYPikJ7+67kfO2JyyAI cDtgHgMJn88la7NIIJlJAMeO1ZcgUEXEmm05UcIRRVIAI/P7SY0KP1gQgw3bYUEiACaj8EV8jQB rfOU4IH5NOd/wJhDM3WGiBCU= X-Envelope-To: linux-doc@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 6baa505504c9ca05; Fri, 04 Dec 2026 06:20:13 +0000 X-Mizu-Trace-ID: 6baa505504c9ca05 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=us-ascii X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3901.200.71.1.16\)) Subject: Re: [PATCH v2 17/35] hugetlbfs: don't overflow the pseudo VMA address in fallocate() From: Muchun Song In-Reply-To: <20261203-hugetlb_fixes_2-v2-17-9bbeabb555d2@kernel.org> Date: Fri, 4 Dec 2026 14:19:51 +0800 Cc: Muchun Song , Oscar Salvador , Andrew Morton , Hongfu Li , Jinmeng Zhou , Mina Almasry , Davidlohr Bueso , Naoya Horiguchi , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Vivek Kasireddy , Mel Gorman , Hugh Dickins , Baolin Wang , Dave Airlie , Jason Gunthorpe , Andy Whitcroft , Roman Gushchin , Barry Song , Andrea Arcangeli , Lorenzo Stoakes , Suren Baghdasaryan , Shakeel Butt , Pedro Falcato , Jann Horn , Guillaume Morin , Yang Shi , James Houghton , Rik van Riel , Harry Yoo , Lance Yang , Axel Rasmussen , Peter Xu , Sasha Levin , Kiryl Shutsemau , Christian Brauner , "Steven Rostedt (Google)" , Hongbo Li , Gregory Price , Zi Yan , Joshua Hahn , Rakie Kim , Ying Huang , Matthew Brost , Byungchul Park , Alistair Popple , Andi Kleen , David Rientjes , Joern Engel , "Aneesh Kumar K.V" , linux-mm@kvack.org, linux-doc@vger.kernel.org, Gerd Hoffmann , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Johannes Weiner , Chris Mason , Jiaqi Yan , Sashiko Content-Transfer-Encoding: 7bit Message-Id: <048C90BF-48A3-4C71-9D30-6C09BD8644C5@linux.dev> References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> <20261203-hugetlb_fixes_2-v2-17-9bbeabb555d2@kernel.org> To: "David Hildenbrand (Arm)" X-Mailer: Apple Mail (2.3901.200.71.1.16) > On Dec 3, 2026, at 19:37, David Hildenbrand (Arm) wrote: > > hugetlbfs_fallocate() allocates folios through a pseudo VMA that starts > at address 0 and file offset 0. It passes the file offset of the folio > as the address. The reservation code then derives the reserve map index > of the folio from that address. Confusing. > > However, on 32-bit, that address overflows for file offsets at or above > 4 GiB, while we still add the folio to the page cache at the real index. > > Consequently, fallocate() of a single hugetlb folio at offset 4 GiB > consumes or restores the reservation at index 0, messing up the reservation > accounting on truncation and eviction. > > Let's fix it by setting the file offset of the folio in the pseudo VMA > instead, and passing address 0. > > This has low urgency, as it only affects 32-bit kernels with hugetlb. > No need to CC stable. > > Fixes: 70c3547e36f5 ("hugetlbfs: add hugetlbfs_fallocate()") > Reported-by: Sashiko > Signed-off-by: David Hildenbrand (Arm) Acked-by: Muchun Song (ByteDance) Thanks.