From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382649; b=j3EcZCfsTODi6srv5egc/0QJA6jT9SxUkTm8vTIrm0USfQxoxa06a90d8/RSh38mZp4N NzNRL99S3MLntTB0xiivg+xEvjmMp4ZIoeCFQ8TfdQhefFO6GDdsvcGco/mYx17n1xspx L7b9SKdFhhC4xGUQw/4opTquZcgXDiaxeLbzjVAXggDN7fmtniE8146hV6KzmKdL+oGtm J3wqIKI+lV5qWd/dqpGFHBOU0jeWyrM5LKx6/VV5aRogjOEL4UI9wWjBEZ4vG0jKgCmgm 6sZp8ya68EwAhIUrruenRR7VGytvSAkwuGqDo8cynglB9eKWHRvTSgDjxYYnCCQf9kQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382649; 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=s/zWNcH1PSsehJBxSy4dQlrNnt3oyJH4gbxF8Vsc7vY=; b=jUyWmM/3x7CDHrmiOgbLnLkAldGntd2KTN9K3I3U1zd9uOruz/fiibwObU9dq0TC4moc G9YYIoyOO+hWSmngRuU+VGtCE356QiZPBQgWxxBxo525ayLpexmNzOt7NicwCn7SSTtZT oJrPLY9x2jA8o0NV8bH1lraXXOA4GTUc7XgMprYMSRMTL///61X2SlHrWmeaO5SArIYRc CxwGLvcJualup26gZ0dqQxCmj0bLofMe1p6P1ETLBtt68PGDrBm1hHpxBAFnECWMg1Fon Tnl/V5WavgHjVx4ru9+MJD0Beo7Zb2QV1f2V+GxSj1aHqnbeA/uuH4bk2RCXjFfLofw== 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=AonxsZKk; arc=none smtp.remote-ip=209.85.128.41 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.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 AC084606A322 for ; Fri, 4 Dec 2026 11:10:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AC084606A322 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=AonxsZKk Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4bb70074ab2so4721885e9.0 for ; Fri, 04 Dec 2026 03:10:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796382647; x=1796987447; 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=s/zWNcH1PSsehJBxSy4dQlrNnt3oyJH4gbxF8Vsc7vY=; b=AonxsZKkG25vJVq/EaD/PbxaCkaNqfIpxuvX3luDcCf1S7O55PmnA/CrdQ6ZwSUwWE Beg9etRtE2BofNtLMJForjb4XWUG507puSocuJTOqD2KXre22Yx3tmKuGVrMQSnuL+Rg rildyApkXiq5AgzcMPZRcWyS0l5dJmVyt0lfwlD3eacm67+yEPhcVoD38EQjNsGf6zcw 48LqT6hkpTxrpmndTZjYBLFtIdW6p8x3WnM63GuNNtjFdxG44uLdI266jCqEGLCObw06 tZAOqVhH6/rnBvnNKI6cv3THHETX5LpJd3hE0JXPLJO1EciwXtkOIfxAmXdUMe7Ojp13 EoyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796382647; x=1796987447; 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=s/zWNcH1PSsehJBxSy4dQlrNnt3oyJH4gbxF8Vsc7vY=; b=jq5Ptpv2n7WhZDYz7ZKTLKg/rsSUAdSajcwHSHy3enjvbtRtF4WRJL95w/jpR38qvx hlrtDPgTFza1DE43vUYj5C2mPSdZKmM/e96UEXQ6rDT3ICHawcFASNXRNYAg1j8jQD1t eS/t1DexlgIU0jG5F6lZzUmSdzzBEToXAmX5Xf5avIcImzaLdtgeRJXecHVu5zL2I1Lx xMHP+jVSlI0B352CuaawwFjiZBQf/gl+H9jK57jn4rPQHFs2BQk9NGPUA5PIb9thsoUR X71iFrTfh5gA3d36vXwrUoQHCf45doF3EVg+IPyW2Qss1Alz871Tz/Y1iyoYhyFgV9Z+ DBiA== X-Forwarded-Encrypted: i=1; AL+hErGnPTIM00H+xF1xA78Tht9mnvJhykc+7XiDXpTSv2EE3DaHUrNVsqkdC9i/U8M6+02OdbYCUrP7UeZfUzE=@vger.kernel.org X-Gm-Message-State: APuU4Z/wPrP28jmr/sNyaxfIM92nmtMhrOMzjqnUwC827KWi5aF6rQ67 V1SS2uQ2TLpuSGeuiKFkaqpNFEhbBeDsQgrBC5bSzVPoDJnNULgeaMbp X-Gm-Gg: AZFdTZcrMi6AiDBuNxBBt2sHKz1QI2ADvJUcIEfgSyjVKkqVxfy6KlrVJU0sLDXC49c mhk2ByBX4zzbnPFTT0debBzBWhjMTlJjyWEhLTYumji/jFBygPBOJ4M8g56u3ZTs+1dPv/nLBqU 4NGA7G0R99KBs3KnQkHrtqQjyjkfpCd64Dt+fEGLTGBiWUM2FndCo4hdF+zaPACvIV1U8vqi1wO r1MRv1qo2UQzhFtMXI7D9TZOuijAHmf7ezK590cX0eZOvS97E6fA9i8oQJa4mfokfTcCP73lXyZ aEUPclgNEUGSMyUK/tUjdA+dvrbJ5q1QN2jGk43eP+AT9rY/ybdSUNg63vbCAMoqTUD2DcMQRed fsNYrkA9csGCL5IiJaTAWLBfow9gsmH26fnrexJ2+7LcfMEebHFCSvAUab5om2aSGxRIvvnWkdB 4JCAHL4D8F+M5rmQMuEff5fg93pshYgVil2j2DYIVVm1BEKda3p6Klmd30T3ei8mVvSnrl0b6ba Hu3pd+JY3CGmbTq9ZXvdOfTgE2Z36Lzlfplh8K3sXs4vFyNfj+i//vlJ3XuGE5GJ81NYbb4A+Do dgQs9LHCuK6RCYeA0R4d8CScK99Y1FLQm5cRO/uPT3a8Z8AbNfZHbBQ= X-Received: by 2002:a05:600c:c8c:b0:4ba:761:c0c5 with SMTP id 5b1f17b1804b1-4bbeb8bd834mr30904045e9.5.1796382646855; Fri, 04 Dec 2026 03:10:46 -0800 (PST) Received: from [192.168.1.22] ([83.231.69.9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00890bcsm140246705e9.7.2026.12.04.03.10.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 03:10:46 -0800 (PST) Message-ID: Date: Fri, 4 Dec 2026 12:10:43 +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 18/35] hugetlbfs: don't overflow the end of the unmap range on 32-bit 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 References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> <20261203-hugetlb_fixes_2-v2-18-9bbeabb555d2@kernel.org> Content-Language: en-US From: "Jose A. Perez de Azpillaga" In-Reply-To: <20261203-hugetlb_fixes_2-v2-18-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: > When truncating a file or punching a hole, hugetlb_vmdelete_list() uses > vma_offset_end() to translate the end of the range in the file to an > address in the VMA, limited to the end of the VMA. > > However, the end of the range can lie far beyond the end of the VMA, and > on 32-bit, calculating the address can overflow before we limit it. > > Consequently, we might unmap only part of the VMA, or nothing at all. For > example, when punching a hole covering the first 4.5 GiB of a file that > is mapped by a 1 GiB VMA, we only unmap the first 512 MiB of that VMA. > hugetlb_unmap_file_folio() later unmaps the page cache folios, but > anonymous folios in private mappings, and for example poison markers, > stay in the hole. > > Let's fix it by checking whether the range ends beyond the VMA before > calculating the address, which also simplifies the code. > > This has low urgency, as it requires 32-bit and punching a hole that > extends 4 GiB or more past the start of a mapping. No need to CC stable. > > Fixes: 1bfad99ab425 ("hugetlbfs: hugetlb_vmtruncate_list() needs to take a range to delete") > Signed-off-by: David Hildenbrand (Arm) LGTM: Reviewed-by: Jose A. Perez de Azpillaga -- cheers, jose a. p-a