From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B28562571A0 for ; Mon, 24 Feb 2025 12:03:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740398597; cv=none; b=E4FUF2azXNp2FuLbGNI4aS5LhQrEDOu7KGjrRYeM1Si3zll1j5aiH+rJW2zkmU84+poGTHRG83iNgPMea401qhhaSvpvYtC2XiQD3XIQ5nb3ENpoYWKFmHFlP49Bf5GKk7ia1fUeUaYJZCuWE4uqWbOKEIAbLtLmxdVpogsDFCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740398597; c=relaxed/simple; bh=exjiSLOgk+mEzhOvTz8LyReRlc0vRnbs1cgqAleNrkM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WyVQnXXQxNMRw6RsObtfebT5OJU6XqjZD3+3Yvy7sYYlqo9cHyr0nGKEJwavcoUWx+OL5t4oMAlf1FWTv50OuaekBJbMBr3hYb+OL6eKEkjXO3UbdwRw6h3d1eqdIiLI82o7jTFq3jqAF4I5pv5M7fkpip2ov7nkIy+CR9PEdNo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AA39C4CED6; Mon, 24 Feb 2025 12:03:14 +0000 (UTC) Date: Mon, 24 Feb 2025 12:03:12 +0000 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Pasha Tatashin , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , David Hildenbrand , "Matthew Wilcox (Oracle)" , Mark Rutland , Anshuman Khandual , Alexandre Ghiti , Kevin Brodsky , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 08/14] mm/vmalloc: Warn on improper use of vunmap_range() Message-ID: References: <20250217140809.1702789-1-ryan.roberts@arm.com> <20250217140809.1702789-9-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250217140809.1702789-9-ryan.roberts@arm.com> On Mon, Feb 17, 2025 at 02:08:00PM +0000, Ryan Roberts wrote: > A call to vmalloc_huge() may cause memory blocks to be mapped at pmd or > pud level. But it is possible to subsequently call vunmap_range() on a > sub-range of the mapped memory, which partially overlaps a pmd or pud. > In this case, vmalloc unmaps the entire pmd or pud so that the > no-overlapping portion is also unmapped. Clearly that would have a bad > outcome, but it's not something that any callers do today as far as I > can tell. So I guess it's just expected that callers will not do this. > > However, it would be useful to know if this happened in future; let's > add a warning to cover the eventuality. > > Signed-off-by: Ryan Roberts Reviewed-by: Catalin Marinas