Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4396464pxb; Tue, 26 Jan 2021 22:14:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPISUBLjeOladk0LWYVsnoRZ3ZFrHfXzjauytyfpGynzXsaKFZwos7hKwv48/NxcY8/0zB X-Received: by 2002:a05:6402:1549:: with SMTP id p9mr7651790edx.387.1611728048647; Tue, 26 Jan 2021 22:14:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611728048; cv=none; d=google.com; s=arc-20160816; b=UklZOUwquTF3Du01SVROk43bnAOhkGCWh0zAh2shEXFwbgSZ8JrNBOehRFvg9SORBs y9SyrCeKaUSvnH+qsoL+7FCzugTv6sYE9Erki9cXAeWcsqrQCiHH8IYjqMRiK4p6CP2B 5wzr0Ru+rYIVRHos7DQ+vvGOp/m1yVnjc5b0xIQOcLBBZ+RHLkknkVaTuF50MHAvLN1B DnUamx4L0RgxGaomPkH9Fq0X2mHWk84A2B3oFr0fYH2ZnQ/Hd/KmEN3BFNQuo3ujNxes 60wo9e2v9UB4RJMHlaZs2Zt2T/OaegdNgzTLpS5io12bLAjHqomgh+jF4DpVd9pvT6IL pcAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=mbBR6IKku7++ckdkOLaYM/oCACfMAUACy6LTo39T09I=; b=ZhOPl2DxiEDVgxxXinIxYpu26gMrNSEYmJh5FhvcY9ZrtQmDV+NE4w+uB4OiiqXR5Y FFq7qfryFKw0hMuzzAx9aP2yIpmQ6L3n/8IWk3N6pcilZeqqE1Xzmc2QMhBvuTRp87XP BIRWaMQknPgeaNIhd981BQBW9ynbWuF7vBwAs4/dcDC9VjUUZPMn5v6d+FLBlzQYaqxS DWm46Xs1SJRXb99G5Qx7muKLlhgcWfbX5MY5GsZAqaH/lIXeUyB3m7kKqt79Vjeck5QU QjC2noWAwaxIifEBYBH+igjAV/IxSWI7qF1HEf1PBQa7ZUXs20JL/apWHrxMi+fIUwpu oQNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc28si479165edb.181.2021.01.26.22.13.45; Tue, 26 Jan 2021 22:14:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394085AbhAZSKF (ORCPT + 99 others); Tue, 26 Jan 2021 13:10:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:54752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389836AbhAZQhX (ORCPT ); Tue, 26 Jan 2021 11:37:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A940C22241; Tue, 26 Jan 2021 16:36:41 +0000 (UTC) Date: Tue, 26 Jan 2021 16:36:39 +0000 From: Catalin Marinas To: Vincenzo Frascino Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, stable@vger.kernel.org, Will Deacon , Mark Rutland Subject: Re: [PATCH] arm64: Fix kernel address detection of __is_lm_address() Message-ID: <20210126163638.GA3509@gaia> References: <20210126134056.45747-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210126134056.45747-1-vincenzo.frascino@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 26, 2021 at 01:40:56PM +0000, Vincenzo Frascino wrote: > Currently, the __is_lm_address() check just masks out the top 12 bits > of the address, but if they are 0, it still yields a true result. > This has as a side effect that virt_addr_valid() returns true even for > invalid virtual addresses (e.g. 0x0). > > Fix the detection checking that it's actually a kernel address starting > at PAGE_OFFSET. > > Fixes: f4693c2716b35 ("arm64: mm: extend linear region for 52-bit VA configurations") > Cc: # 5.4.x Not sure what happened with the Fixes tag but that's definitely not what it fixes. The above is a 5.11 commit that preserves the semantics of an older commit. So it should be: Fixes: 68dd8ef32162 ("arm64: memory: Fix virt_addr_valid() using __is_lm_address()") The above also had a fix for another commit but no need to add two entries, we just fix the original fix: 14c127c957c1 ("arm64: mm: Flip kernel VA space"). Anyway, no need to repost, I can update the fixes tag myself. In terms of stable backports, it may be cleaner to backport 7bc1a0f9e176 ("arm64: mm: use single quantity to represent the PA to VA translation") which has a Fixes tag already but never made it to -stable. On top of this, we can backport Ard's latest f4693c2716b35 ("arm64: mm: extend linear region for 52-bit VA configurations"). I just tried these locally and the conflicts were fairly trivial. -- Catalin