From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381899; b=FoIQkfkCrPCtn9zZorj9lGgxDl9jqMWEr+ITcE8RREso/DBv8Wkm/CS+EezM+Pwo2phV YnL3QxFKgR4nBXJ2n5S+HJrNRrSld+6nnbltBQNIx9NsC3L7kAuI21YZyfv67WZRs+1XI X1TSFyPzov/02fBtA6/JBBB8BuDnPzD4qH69+Z+AbeDO7TefTwWBCWTicA7LtaWvDESbE Z1oVB1L1q6UZMfaYO+csBDPNXVCfgrr3/1tp/2ADuMWEsw3XdlqI7VBxUKq3K5yoPSFaW MI9UW+N4ABvGaZ5hdF8ecN6OwrcVP7hztjozKB+6kwhI6tHL1rppPUdyjwVOIoTQg1A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381899; 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=YjCet3Hs5ZF2AWBKnxrEpOa2Ow1nzsyQ1/K1K+iZbdQ=; b=0C1wrBO2k5agtAkufIV8ccu9g/vyhHkgYLPCCwK/+H+kNRFQnMsyP54BqIt9IXIkmikx nYUdHuVhNfjS944VzJaVLHwqHvXphJNDYI4te8lIdeDvoYR+Kaj4fMsTNl3g7/8QWmEvY ETRe5W0NjB9K3h7L5TnVfmZhZzDpjd7JbCQmHDmrCbkSzt6ioZezer42gAAkijKwVwqlS pff8okoQ5pzzzbac0fG/hrzlsoOfk/kGp30yH4P49fy2bHIrRHIp5t5H+fxquKmO9t2n2 1lKf87M6+BvOcEZskGSaN+M2D1ptuxwh9B2c4RbE9BN16ibeOymfofa76OvoLKydqQQ== 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=GJRXfPP6; arc=none smtp.remote-ip=209.85.221.43 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 6088D606A335 for ; Fri, 4 Dec 2026 10:58:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6088D606A335 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=GJRXfPP6 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4a358881793so356113f8f.0 for ; Fri, 04 Dec 2026 02:58:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796381897; x=1796986697; 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=YjCet3Hs5ZF2AWBKnxrEpOa2Ow1nzsyQ1/K1K+iZbdQ=; b=GJRXfPP68hJXrjV/nmCCRZp5XnkZfptUtsVVkhe8H5U5NeOXrhzlfZNAdQQ/VHKkK0 0HJG25MnOCoyKYJJBFSYDEmJ8oOs7+/JbY7jVsWT+1g28aKA6iN58l32RRK61MwyhXLG +6U6qSDl4t+7mfwhHgY0t47/o8QFxerv/bJTm4SALguHLvF08mqhz4Pre1wKATb8CGKI E8udMi/Cjxnwefy5KI+hqM5ky6pcxlR5PjXf6gGFbhleeYPMeE5hr+ka8ZHTcMGLGm0l 62Jla4sdcnXpFWjUaJv/PYkHUpK6+iilJJK65lUuPh8nFiusiy+FrKyFq9yc9U23NxGT 2HMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796381897; x=1796986697; 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=YjCet3Hs5ZF2AWBKnxrEpOa2Ow1nzsyQ1/K1K+iZbdQ=; b=OVE9y/7uajwqcQXLMa1pQzT5HJMFNE41CCn6fEmFGWdmHwRLRZk+nyv/UrvEMN584Q XR7Ds0XukGTNSR3zMN0GUXmUAjM2AonLG5bIkBLG454qf+y1CLVDPyIeHSZqZL4sGeGq lNiJsO6AOscNXCS3BUDSqDtxdVpudreZyz2Fl7UX29H//Cm0onsS2Sn+9T3x4CM6bR+d ifNoMT3qM0PolBnTUs7+hL90/vPJBOeg2ONLlMIq8d9od8byyRD6msddkMF5kh166iKY HcqOhP4wdVXI90NUGN0ZpE1fCC78U1xUYlvbRajgmSh6e8c6uoeloLLpaqUsdLBu2vm4 QGwQ== X-Forwarded-Encrypted: i=1; AL+hErFNfQmu3ScxYS6tfNyPqkTp+5G7OqVXxZwLUqsJxwsjvBKD7RNz7z/cP12xCPkzZyZLbYA0Wa5lvwBX5Kly@vger.kernel.org X-Gm-Message-State: APuU4Z/AVdSnXOagrSPPmGTSKoIzkNLnDcUFiSgAUuiLLLl9536iT/vW 29TI6zch8md0RvAfs83WVbZ9+lTbSf4HKYvi3vJSUalKaWMBkgA6rZCa X-Gm-Gg: AZFdTZc6LiM2KG6jkru5rhcAAEBMwsg4K5R1C3eP45OS7zH51wA1eaPSUHcSWxEvsad vwLQ/1KT9/mkkHfG4tLiBU6KZmnMSGPkxF4S7igqsmKQVSwlHVykmy3hfGIzM7KVRBPL5a1D0Ms Pkq52MA2lUd9QalAc7MXXiYGlQLa58Jzw65MzSHVw+C9j45C/jYVqJZyntXn1Qu04RtZB14Pt0M hWhqmkoEvhzhToTiHXTZBzfKd/q8+SHp8sW8aebS20DI8ad+wcpQ+abkk0ibX57SL3FMNhwo1hV UbPtNOQtBnXLG9R9qJvOsc8/pOSMjoBWUm19Hfe34nkK2jWDMc7iCBv+HbMoCal4kArbQbIJa+3 7Dki8wJpi0IPSBmfBNU3B6wSE3Lzs+lzPzJhV+SX/LmEBgzzWHgzZOJMbfiWajJuVV/zryPrCwk L/RNW84DP0u0oB2YfGgmWJNcXwQmMO53BWgCt3WU6wz5UcaU1AUkGxwk7cmx5e9RgGFXW1E6IsD qRXaqzTX1LcWDngqc49yNBmWO7aEUIVxpvhqW2xGDMIwXtXlXskiAvEjwx9Fxr7hw5IlYx860Dr NGdnrntiE+6G77E/nErcA8yfPEZuMe9I7QyWG91pWC/CTkPcKEhlPepe X-Received: by 2002:a5d:56ce:0:b0:4cb:8315:ba1a with SMTP id ffacd0b85a97d-4d1ec91887fmr2597102f8f.50.1796381896721; Fri, 04 Dec 2026 02:58:16 -0800 (PST) Received: from [192.168.1.22] ([83.231.69.9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d1724ad3a5sm5856187f8f.9.2026.12.04.02.58.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 02:58:16 -0800 (PST) Message-ID: Date: Fri, 4 Dec 2026 11:58:12 +0100 X-Mailing-List: linux-fsdevel@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 14/35] hugetlbfs: fix integer overflow when punching holes 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-14-9bbeabb555d2@kernel.org> Content-Language: en-US From: "Jose A. Perez de Azpillaga" In-Reply-To: <20261203-hugetlb_fixes_2-v2-14-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_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. > > 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. > > Consequently, we will zero from the start of that huge page, not from the > offset. > > 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. > > 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. > > 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. > > Fixes: 68d32527d340 ("hugetlbfs: zero partial pages during fallocate hole punch") > Reported-by: Sashiko > Signed-off-by: David Hildenbrand (Arm) LGTM: Reviewed-by: Jose A. Perez de Azpillaga