Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2300205pxb; Fri, 5 Feb 2021 14:18:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPoTID4eEbI3qTXLs7k+SjvFet3kRzZ9pj7NUqz1R4D2XXN9PloZMX30rf2s0+yQneF9zU X-Received: by 2002:a05:6402:3070:: with SMTP id bs16mr5567904edb.22.1612563532138; Fri, 05 Feb 2021 14:18:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612563532; cv=none; d=google.com; s=arc-20160816; b=v6lMvmPOa5WQqTzausJirah5Z8a0C+06LyWXIZT/5lrYqZfcdiQj35ixAfyWONcHjV VKjKgNhGtqEDvRteqrpe9r2EmQcnPq5dTAQL51WbVJTRjUoVueqBFpBmqbj75gFEgGIH C2l9PXyheh3Qjhb0cCEEDrmN0MZAP8C9g6CI9vTYMNQbP9qbcohOyIvHphnvhofkJMEW wGwwA02IilMiw5FiDQ9v/7BeDURXSrhEcHJovMsw4tvdpo6nw0xhzToqsUlZwXLDFL1k kFiEqkeg7gVS/gzUTiLC2Jm/NfxDzfW8mjEYGqT6NKREei7dIMXXs5Ob1kAITjX2uQU0 DKWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=60fcILSf34BmRtQ4bhEov3WGdLTCbZ/pZ+tX73VY6Gk=; b=w9pvq5gI7eoi6/8YyRYWXhic7SD86Dxu952RyO+xOnxddL3uzHr27ZZxHwR5+fESC3 qD01dq8hKnlF6cGYDT1Z7crMlR2YASmJo0xp3Ssmo9WiIdTTtAzKuqrgNC6gQqPk2Zdm WB4hhO7OcaP4hC4cH1HjguKLNxmrYHiO7EFopHb3rd5Ijb3SEG26HRvlJzlr1BZw9rjs Fp0K0KjCIolTnc5NYiF2w+duvAx0jK1VqW/DcPocft87EilpRtycPnQt001m6EHiwCvS +DqWBOxUGqkJ6vKSQoSM7eztCfxnVQnssKaetkJwUYmGe5oBlHjmPHueb29+OlNaC3GX I2NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qH+8jweQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f27si6789479ejf.555.2021.02.05.14.18.27; Fri, 05 Feb 2021 14:18:52 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qH+8jweQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233132AbhBEWPi (ORCPT + 99 others); Fri, 5 Feb 2021 17:15:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:44984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232931AbhBEO5T (ORCPT ); Fri, 5 Feb 2021 09:57:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E047765058; Fri, 5 Feb 2021 14:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612534352; bh=sUCSMGgYb319zNRdR6buytA8eu3g59oCfCt50woq2ZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qH+8jweQmF1ScmxlAY4XyZibgZvFvh6Za8CmaxDY5m5k53GVqtyo6hJkgGTwYtb4r Hef/+W1mygKMbcaihiaiWNQblNLbMfYBlX0IPwq6oDDano03VzgmgGirO1G5Bt9jtX jb4uDWegSlyytFViOghKDY/V7JpfX9GTbYhnYGrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Ard Biesheuvel , Will Deacon , Vincenzo Frascino , Mark Rutland Subject: [PATCH 5.4 07/32] arm64: Do not pass tagged addresses to __is_lm_address() Date: Fri, 5 Feb 2021 15:07:22 +0100 Message-Id: <20210205140652.662436384@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205140652.348864025@linuxfoundation.org> References: <20210205140652.348864025@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Catalin Marinas commit 91cb2c8b072e00632adf463b78b44f123d46a0fa upstream. Commit 519ea6f1c82f ("arm64: Fix kernel address detection of __is_lm_address()") fixed the incorrect validation of addresses below PAGE_OFFSET. However, it no longer allowed tagged addresses to be passed to virt_addr_valid(). Fix this by explicitly resetting the pointer tag prior to invoking __is_lm_address(). This is consistent with the __lm_to_phys() macro. Fixes: 519ea6f1c82f ("arm64: Fix kernel address detection of __is_lm_address()") Signed-off-by: Catalin Marinas Acked-by: Ard Biesheuvel Cc: # 5.4.x Cc: Will Deacon Cc: Vincenzo Frascino Cc: Mark Rutland Link: https://lore.kernel.org/r/20210201190634.22942-2-catalin.marinas@arm.com Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/memory.h | 2 +- arch/arm64/mm/physaddr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -332,7 +332,7 @@ static inline void *phys_to_virt(phys_ad #endif /* !CONFIG_SPARSEMEM_VMEMMAP || CONFIG_DEBUG_VIRTUAL */ #define virt_addr_valid(addr) ({ \ - __typeof__(addr) __addr = addr; \ + __typeof__(addr) __addr = __tag_reset(addr); \ __is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr)); \ }) --- a/arch/arm64/mm/physaddr.c +++ b/arch/arm64/mm/physaddr.c @@ -9,7 +9,7 @@ phys_addr_t __virt_to_phys(unsigned long x) { - WARN(!__is_lm_address(x), + WARN(!__is_lm_address(__tag_reset(x)), "virt_to_phys used for non-linear address: %pK (%pS)\n", (void *)x, (void *)x);