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=1796381898; b=vQcGU3zhzOWL6Lqtl4rBuuz6t8L9k0uftFLG+GUICSbCYG7tGIRYQtItoE8HZP+11oLG 0G4j/lZmKMkur8cV+ea15p6P4XaWQaavClFenG3yE5iWV8MPa4/g01LR+dCzgl8ysHH+T zT/j1S8LJPbGfbEFWc6DT8cT3b3yiyfXSmQ/DFwyQIiAuY9tuRlQpBwpbdN0SSr3GPggY zmP3Pk6elM4BwcupqxXiNzQ7cIR9GZNudmo4poUqFQDZpQV6baEHwe+jiHGzkv94vjV+u QNl1GLAra5yXdAkTpZixZRB33JcJo/DfEfQrAzliRdTc9tNdKVTgnwDbdASNbJgcSBw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381898; 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=4sf+LldpBG6bKvYiOrLuLM9AH2y6SFOCmXKZmFDalN54HklvqgE1pu61eoEwGiclDLq6 jyInNJlv2OcT7IXId2sFyrVDoGB8vaTBK/GLVKLL+XgrOih0ZUfmCnASw8x6F+sDIFczs WUZkGlIPGUzcWVa1YstgUgxj24Kl1195GPZAppOiuJ5iVFCUb7xit9pzQ97Y43X43c5af hfVchxbzm1I4L7kg4mS4DD6UL1YB9HzK2FHQFLSadh223znYYi7GSfRaDhf4G7on+2e5r 6tO98k0EsIbo1QWOEKLC+1C8iOpQeOfTi5xjleGIeHw39AXJs7x+L6FCh7R6oxmk2jQ== 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 612EA606A33C for ; Fri, 4 Dec 2026 10:58:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 612EA606A33C 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-4cf418d85bbso395032f8f.2 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=nUfVs6SaZvVEdXdt92UDKuQaejH5s+pFzTGyE1phNDYEt7Iia/w2FGIiNNj3MKBK1M ZVY101ef0tf+vanmrjYEsb4JoNMvNCmdyAyi3D98VY3DE1d78YBhA6fnICg1Hgre5pir wAScB13NGGVacxKozGbVacQH5nezcY0TCJ0MBnTj1t8DfQ1wFtNg14Wnz0MgcjYg2/Vl kaFDdRgCynCf3J9EO5d3fegoTgRvJUxMpsMXUePUr0eQGkmzX1H8Q9io/uO/hek5C71i RROUC7xiKWdhvI9alOXYrKWE2H+zxUhj+TLuc+WYBpesZ8EcUiGOovDaolV2OZ9pRnXH 0IcQ== X-Forwarded-Encrypted: i=1; AL+hErFjOAjziXOkiw+Njwi59AaBBjtd5SWXnbhkJ4CFdXlloR++qX45MvMVn8pLGnb2Zm8R/iLZ4WzorwMU7SE=@vger.kernel.org X-Gm-Message-State: APuU4Z+zPnLm0cQLDwL1uGyVRWQr2ZoeFE3rmc0jgGOf6lmg8i+D2fFT TeiOyvoryyKyDmcztBr54TDN6MfqBF9g/lGxAaJ1/huqZ01KubaaEeHi X-Gm-Gg: AZFdTZf9gPQ/kE4FWbb23gZiKzSzbw0tj/Y7wJYkPXAwEETf1qSCzTnVDMTSkM6lpK1 +pYdxHG1cQvkvsN6s67j+eHw5E3E+omsXIlw/Au3fH8EC9I5rw7qUF3L8GcVhbpp/HEQClc1fK7 E33ioTimv+gUmyokwwY5wbDB183yh0TWDOvE8eCNo6EVVofbUj8aHr7/+AqhYbIYc6N50jtSDIS Zw9qJrBoHBvdcN0d4WFFeNm45iQ0cuv73f20qe+pboPZZ8noN8uUx1F2x1i4jLAn5epZsVygmR6 k/FqGKXcC8YTDnsJIk776jP7g2CZzEKUtsgTyz6wfwScATbOCjLDqFmp+CREj8/yKngAW8YXflk y5IgB6SxYNy/VQ2bdudPm7B5qBkW9Rh8WAnlRRsb7FhTtAUzcRIr3TaeXc2Y9bM6pQuACqXuoSr I16oR53g9KgMhOLSPnEAKUH+xouYjf0MIFooxbIOojUOsV5DM8U9QUBlOcxmDOthFGk18HCGTto mO+QKVqKVP5n3Lji3uX9LRuSGKE0zYx6vq6ZUx7vDxM3oxI6yLFK7ZD2ZjC52yhxkWi3991ZHS2 MxyTZbg6qAZc4iNU4UfPUmv5TTERlwIMoAd9dcXkN9o4ByTdFVS/1SBe 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-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 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