From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382499; b=Kr4E4AMYYBxqW1HU/HwRPzB7zUhBl2+MaK0WYr+37H3Zi5s9sxeq7SKCO+3psrd8T0hB R4g1YHQX+QuDQ43cMDC6i98j4rnxnmjhGcbmtTE5I6PUlvGPciStGPLaZhSl2wLcCYKoG vrwyXaXZoF6WrAOJ+3Jdfc6LmCyBtNkexPH5DJ5fpBbmwho55dqfA7Wu9zYONIzu/9q9Y EbMTqAIM3bs+Fq9TRs9Ksh9FKhXrjkteaGNo0B4CWCcOcsQZw8+zcCGpxC1wK8ZuAJYln /hXnyG7kRpnj+AodPEUVZAGFRMMY52rUPDx/i4tHnSR+Ktw003S8Xjo2B1hED79csEQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382499; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=tPmHjf+wwd1yN5NFmUUemYASY478EB3ekSD311DnsFQ=; b=UrMGw2L938GZu6lPYDb8vqP/j4fQNcWV25bkSie/E2/jPbQP7EwkcQqwyj82pwil+Duv sThFNNXH1SAlc/HIqHi9hIf7w5sJYlqkR/BTCgrBA9swexx4Jrh0gS0upFMmJ902cWCKy iq46JjnQ6JFEYyOM4JNq3yVWB6bw6F283kLxeCpu5P7Hl9Dvsei2Gl/FoFS357zWv2F1s 5Q6rTzhPuZ3pbmtfeL1CdbchGFaliEa1LppbY5KQYU0ITvCbN3AU1ioThLxQdPJPXHQUj UPZT3ak/ZY9mXJF6fVsaEW9lv/Rnp9RhC0tXnI3pjxU+/WuAvbk6h3nDwN8rj9Y4sEw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=SVmbbv1r; arc=none smtp.remote-ip=209.85.128.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 A14FE606A337 for ; Fri, 4 Dec 2026 11:08:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A14FE606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=SVmbbv1r Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4bb70074ab2so4694775e9.0 for ; Fri, 04 Dec 2026 03:08:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796382497; x=1796987297; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tPmHjf+wwd1yN5NFmUUemYASY478EB3ekSD311DnsFQ=; b=SVmbbv1rWvyj//KO7aDEU5kW5n4vtm6w8zGWQKafl8XykgqEP+MZP7+YcyBXZpqCzY JG/EFsU3DZ9G/utG/ReP9kA/EZ3hjHqz1wrPkThP8dFM3/IWVDHqoGa2US8J+5SIvuaQ shhVabnmAJ57HsLEJZ/zXUd47iK5skcytEROZHd1hTIYwP68ooGUQxKhhnaBYOE1NPyr oh1qlqahqomvod8At6SHzIqAYivmFRsl73wHgvqXTASUa2fJHiXcw4bMiKkA1p8IkDwK MeNQgjvGBk+vcEDfCEt9VPwg1iEVwmrhAmzYd/mPxLkNq8vvnt+AvI8XsRBDzH9qYbed xfYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796382497; x=1796987297; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=tPmHjf+wwd1yN5NFmUUemYASY478EB3ekSD311DnsFQ=; b=j59BJMh4u7nlcJANe52QNREVoWmOgAVDvWubfuoZXmO8aInXZxhuDVGMk/poxtssL0 q5yC7A6twk2JIAJ8A8Z1XusrpiilaVVepoYgmqYwa7Y5G4xbCxhYxidC/fn0EYlht6X3 o/4Cuk6f4M6UdTuK8Kk/A5/Nu4J+Ue5TEZf1KtoEc9OP9rBVwL1jU5Wqd5mtp0L5XRi8 fVCCI9ZEqwfS+qN2XMSPozsee886s6OqyEWsKecdXghM39zOgstXhTtLutguDH3NlXqG iml5geBnYH3OaAE4Tiy/iOjB1jhpk2yWRbSp2HLzHDyVCVbpLIqWXyNkNAoDPSkK2MFO HQpg== X-Forwarded-Encrypted: i=1; AL+hErEu2zTkVoRQM4iXQZyC4PBQGrhVC4mzwbE7CQvbz5VeF/2Te/nhdj1RhjiFUgq/cy+WoH6DKOOcATIBijQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+AWJ5MXn23aamwvTUVpJY590fObiiXz0fsh1NXv7Fa4ipsIwqr N+koCTJZO7/btX4k08R+DjMfODRer4oig14XSctqrTDG2hsibbmMrTTd X-Gm-Gg: AZFdTZfPTixhNQBIsMCi2wFAQE32T78M3X70X6vMo+F8wW7vxqa3DLO118UVvqF/jAq BKtAspR3G2CyAqJJcYzH9H3pEF4h+g88jRFDp7KjtiihdbLbGh5Uvs6OynnBf0AlOjz16r3RLPA BLv6XYUZCUY9Lv6xfP7EB9yyn8NcqhMkY6AuIWfqStI0gA5BnfeEHaSIwoRYEy/0YFZ5NPiMjis TJrtn0oVijInBGild7tBFkwkyIhqa8GxTSCl88XtQTYSkqRDXiePXTkI1dzbnIbHaQzmrKSOEgK 4FoWMp/vj/eW3Ntjd6RfajvsLcPGKf1VNZuVqPaj6lO4bisWvj8pYgB6u4dcuC/Tuu9A26oWBVx vQg+wekVoQOZJ4n2F4rKga7pFJxoBwifvcW/QIBvAxJ6no4dD/YFIXiIIX47X+oZKz1wzEG8mjl 8dcTSFGUTPRxjNUqGAw5JcJ2KAnOlu421gJBQXPRTPH+mluP8J1eKfWmVFF28cMIboilHV7TaL5 b4nX2aigVf40UMe/oSHe5atPbBsHQVXVFa6VUR7rZzKsakmr4YdatrKzscerp8VGfrrDTWXvpVP 7rwydp/OtRvYPQJvgv61iZ1v5sQnB0ZoEK6I3YN3TVidZQzbYKaUc3o= X-Received: by 2002:a05:600c:1153:b0:4bb:6f41:399f with SMTP id 5b1f17b1804b1-4bbeb8df244mr18800325e9.24.1796382496954; Fri, 04 Dec 2026 03:08:16 -0800 (PST) Received: from [192.168.1.22] ([83.231.69.9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00a2f98sm158817905e9.9.2026.12.04.03.08.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 03:08:16 -0800 (PST) Message-ID: <5d1510c4-0e42-4bf5-bd46-8a3ec8bfecbd@gmail.com> Date: Fri, 4 Dec 2026 12:08:13 +0100 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 17/35] hugetlbfs: don't overflow the pseudo VMA address in fallocate() To: "David Hildenbrand (Arm)" , 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" Cc: 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 References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> <20261203-hugetlb_fixes_2-v2-17-9bbeabb555d2@kernel.org> Content-Language: en-US From: "Jose A. Perez de Azpillaga" In-Reply-To: <20261203-hugetlb_fixes_2-v2-17-9bbeabb555d2@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/3/26 12:37 PM, 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) LGTM: Reviewed-by: Jose A. Perez de Azpillaga -- cheers, jose a. p-a