From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.93 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796365224; b=i3uEDztk+EIzrhVbHUONY5/BGc8RxecYSqaIKLFr/RNGJ6pPViLoVBoEm7XENTmifK01 OPhAd8/xXF0WYTq78ginhqEJx88qRA0u49y6EefMBWg3J7e1wHKq+VamEQ+S3god9m1Id hshUJA78Dfh+VZKTl5KCH9vzjDUCrzssHhbRW5U0iiqr02k630Tyl+EH0v1IpeE0zPhgP 4RCGAbDjJLKDnbH6A5lBFtdoF71qK4ALh+jexxV5rDhOX40kWuJ9qTtEEtJz5mwzLJwgt cn62K5k5eZIC8ONgDaSUU0JzHEhCig2GGCJK0a2aQbW9Mzq2785D7EFbsyl/kU+XK0w== 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=nbc5G5guYTC0AwykmAdkoimMnc9qik4bUYJMxzQqdmZJmFjJWN5CpHtaefiJb6vN/hju usbKrrBSNQmFrpFVCg9OsTKScyFBsZDOk/yYPXxkePM+L0fhTAkDcv1nGQqCwIdawTolw Ka4L5lnoJfDD9qyhoMG3Qwch6dwvC1MJFBmnLZyJy6Oil9gHT5xDAu5JGrviB1kC/GTCl DeL7Y6Z75JUJ2mktYi+xNR6zzcowG8oDKvjE3nX5QhIrw3JilNkeaz4QQWvkxTf8jwN5T /nNamMkPpg6uUUbbuAuyJiIoLfeRG3nJbUBYkqky+O5Cw7x2kI/KMt0LTyMxOp5hdTg== 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=Pu5TigGx; arc=none smtp.remote-ip=95.215.58.93 Received: from mta1.migadu.com (out-93.mta1.migadu.com [95.215.58.93]) (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 25526606A32C for ; Fri, 4 Dec 2026 06:20:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 25526606A32C 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=Pu5TigGx X-Envelope-To: linux-kernel@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=1796365222; v=1; x=1796970022; b=Pu5TigGx92YBm1T2pEDKe1KSUmuGhHBvRxrCXp67XeUlHcrWbp61PnZ2K9weOGu9KvxtYKa7 UvkH0/J4yDS0FSODZc6z5smXNGj1QpjxajLwZq2lKlFkUJXcLDjO/SKtV6SkgNEA+36c8+cEjS3 YHp8yDMO2GMmVNKEYcQ8erDs= X-Envelope-To: linux-kernel@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-kernel@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.