From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.109 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796365071; b=IDCo9R1KiQ1k4sWyghl4weHQwi/oJLr8tLoHkaPJVsA37W2ZnvXabzKR/XI0Lab9TtxD 4dqjSP70vOyshM7LgwgH6Z+S7sIgkYOf5H9Ko7QudUKZPO1/mzvdGyAyfniAVx3C2Jrxw +US9YJGRC4TQF4tFB2W7/shAX2A7WaCnVBBGnIai4cdz5o868q5ptrp7eLfEfC1H6YQPY gAl0Dn0fEMpMs4X4MWVfYgYzFg7t7Il5snwIJrp+0pEWuvS/2BChJtzSy7u+IQ9m67NWk Xj3a6EDpNf9zlXxrMjjikgzSUJH3Ej+nTGEEqkGT/A8lOYitooLdMlK+u5VYdXxgPLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796365071; 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=NPHzG15zwfglpJGZs818FxGK8PBfkRn7bUepdpTX62I=; b=ewaISz5EH+ZuFxs5diHweZMlbFPxJngFHguzkRBsYgc8Ss/bNYKol9RQ9XZ9vjqVPBry vHiZ87npbfTjR+DCcGYgCX5iA3esOaHxuLsbdoVz0ESwWvYAw5ECqEryNuhqwxGo5rZhv aNR2O0cyjuVjZ64XR0rWWTn6So77E9uX8EN6Y8VA7ouj66++W8BQXZU67QxuYboW+k7cz BFwxRADLDtzysFX9MuDtcm2ibLQLD/5ktn4V1W16xNnHF8T+mg2l8JvaFoRg8pXpl5TPa RWJhyNi1uVRv+ab35nu3LSthn2v4evW5Fxt2xBMKkCQk6tRBJHzDfZWjU+by5Ojns0Q== 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=jSSDqp3+; arc=none smtp.remote-ip=91.218.175.109 Received: from mta0.migadu.com (out-109.mta0.migadu.com [91.218.175.109]) (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 3D3A7606A32C for ; Fri, 4 Dec 2026 06:17:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3D3A7606A32C 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=jSSDqp3+ X-Envelope-To: linux-doc@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=NPHzG15zwfglpJGZs818FxGK8PBfkRn7bUepdpTX62I=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796365069; v=1; x=1796969869; b=jSSDqp3+UcyWWYCMPahkNhj8f1bcPD0SUMUK/cTyIwmI2bOSgYzYwAZdg52YW8NrtSciu9Zx abgGaaMebIJrnokLFzy4Zb/Baw7qftz3psKGhfexOMTN/JEgWAqvULvtWHXDaXc8GhZeb+Mo26x e/bfvBm7ivGs1zaknRDoOcxM= X-Envelope-To: linux-doc@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 8abf6b67eef481a0; Fri, 04 Dec 2026 06:17:48 +0000 X-Mizu-Trace-ID: 8abf6b67eef481a0 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 14/35] hugetlbfs: fix integer overflow when punching holes From: Muchun Song In-Reply-To: <20261203-hugetlb_fixes_2-v2-14-9bbeabb555d2@kernel.org> Date: Fri, 4 Dec 2026 14:17:19 +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: quoted-printable Message-Id: <6BB802DB-7E76-4676-AAAE-8FB643ACDB7A@linux.dev> References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> <20261203-hugetlb_fixes_2-v2-14-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: >=20 > hugetlbfs_punch_hole() rounds up the offset to find the first full = huge > page in the hole, and zeroes the partial huge page before it, starting = at > the offset. >=20 > However, if the offset falls into the last possible huge page below > LLONG_MAX, but not at its start, rounding up overflows and hole_start > becomes LLONG_MIN. >=20 > Consequently, we will zero from the start of that huge page, not from = the > offset. >=20 > Reproduced by allocating that huge page with fallocate(), placing data = in > it through udmabuf, and punching a hole starting inside it: the data > before the hole gets zeroed. >=20 > Let's fix it by clamping hole_start to offset + len on overflow, as > there are no full huge pages in the hole in that case. >=20 > This has low urgency: hugetlbfs supports neither write() nor mmap() of > that last huge page, so only something like udmabuf could place data > there, which no reasonable use case does. No need to CC stable. >=20 > Fixes: 68d32527d340 ("hugetlbfs: zero partial pages during fallocate = hole punch") > Reported-by: Sashiko > Signed-off-by: David Hildenbrand (Arm) Acked-by: Muchun Song (ByteDance) Thanks.