From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381898; b=RDocX143CcA3Hj3XTuP8p1c2/yDQqz5FMNT+Hi+zFk2kqWY7FGd8oueI9G/iMEcOqCS9 4UaLd7q7+KZWB1S/sN3IyAO1ceaL1287DVGpEFWnkVQt1cJef2Sa7CW/HlYNDZVFIKS/g nR3ko6Moq37QKSLVqW0gCoIxalZC8fXV+RyFa4+tpepBh1mL2s5f+24RnNhn2yfRaw6cl 0D4Nr0+Mek8pkKVrgi5fwmYaeRm2ciwmI6PHTuawjx7ikaTVlg+5hBD0lt1mJiQU4l3zd NOOSVnYjnTkWDLNq6/zfL7G7sphVIkTKA0t8NQWzPFeWMulclXAtw8Z1imeTUF/pDvA== 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=IJ7BzsnNTA5ur5o3x65+a/lkmvlvfvaIyqbD8y7Q2rG7noaS4QuWeOdjCkXESHdc1Cem iJM+WnOZgbXWBkZKdRR7493SjYLzJyzbIZEU3j6XNlIQnBDEx7boqdOmv87QLwEqkyX/Q ZJBlP4PXZQEKWe2i5JoQwpcgiDcpW4CHitc09FJYZK9u8298qjUCbWjhDdtK7I2B+k26Y 0K/ifOdOnrz2fz3jiejNZmD7rVi6rnSBZi0IoipBO/f8T8wgsdcwxjfKRQNznyTEX3Efi aztd9M1lljdfG0//HGPNWprHO11juUDUfEiA6gzSwWmH3b3WrfHsGyMf9HCOwMuD3YQ== 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.41 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 4E649606A334 for ; Fri, 4 Dec 2026 10:58:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4E649606A334 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-f41.google.com with SMTP id ffacd0b85a97d-4cf418d85bbso395031f8f.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=gO4wW78fZLvyuj+7mA9rtSAxESzg81QIsEoFwf40KL34J6tP7T0K9wrg2n/y1iQLe0 1wgbKIzALzDHdACpQcf6GscokFoNH9FJ2vXZ/PR6UBJlUtvWVdmK+LGJWCcQ5iVtyQpQ 7n76a1yNfUQ9liyFFKE827YfZ5/wHy2gOZ8EL7JPzSF+daCS1Dc0iTMxnkNeBgv50G2R avNbgLWM/YT3GS89cCQJ5JiNexaVwilpR5JiYIrvhWmkPmrVW2cekiYI78bgWV2q4Fbk ji2NuH+UjT+QT8/5NcXvVuK47YKnEq9DIdM/2B4+q7acjD62MM+IG8KdXNabnmpRhLn/ gYcA== X-Forwarded-Encrypted: i=1; AL+hErHEaW85do5NoXcBXMN08Spn234BEHLJl0IPXkzICmsxKFAvemjVr8MJl4P7nYnwAIagID6YN/mTUEQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+EZJFf8wz6Y4yKseFHph2/9aoO+aZ9xi5hoL+d53uzQwrsxKCz poW8CUXVxFiYjsESCnJA2uAxcmKPBdsAmqWoQ51IANn70ocWbEjxifpH X-Gm-Gg: AZFdTZf+06AdRE5/G7n2TQAuyb6Np9FmebnhQ0DFZNSYfifZ0C9d6xDIx1O5OIF6hxv V7hhLqttBh/dIE/3c94mZt7kgioEXqu2TvZuXf/nhVbKUR4lprv2n/3xOtALWNTJfQCKVgszEEI AuWNjtptydRm37yhxtFw0CnFGeBd3SpHKE0eEpzZ7Xz2E9miIWAYHiQ62de3ngxWowwn82Hg2i0 Ivlwyiur7NQoBPGNplHvDbR6GysqnuxkO5YB4Cl1HLXBwFtjFjlQaiRFfxrEtX7mPcHKfcszUAS 14lUQHTkzFVOt3vu2088Ap5ADj/GPBvBafCEh7Y/QeLYwvJ/Wg1k5naprbp1dXft74U8qMECHTV lANK/+k3aie3o6isZo8KRSbtSD3utKPcxrOw9QHHxG6ZuuAb+tNRCn6eWe58y9tt0ykqw4LmH1J 1qIC6Xv9kGm26Wz98f401L0w+XbXNfCtTfreb88rEFPBx5AYFcnAIs9x+nw6m9gcNiNHr5fqIn7 u49xGEzKjeBdZo4DLCuh3ZGuzEZM/8eVCZdtodl3C4OnjDoG7sYGSjmQ7CzWVSM095s4YIJEVNp EnycjizP5zbEsup12cVxoPYLObaxumajfDtIIAVE8SrPHlm5vXbcgOHE 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-doc@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