From patchwork Fri Feb 5 14:06:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 376967 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2543625jah; Fri, 5 Feb 2021 11:25:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGm5wnDdWEBSD5dBTbU3y8Mxo+oQAegUUVWAr1d6TasCwfQQ7Ena2ceh27ql3Xtf6Dv9ye X-Received: by 2002:a17:906:958f:: with SMTP id r15mr5285047ejx.360.1612553108733; Fri, 05 Feb 2021 11:25:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612553108; cv=none; d=google.com; s=arc-20160816; b=oerakdNUfBCjjSEkpscgu+tIt3G5mAU4rFakZp7M6xaa5IHBID+SVi19OIfd0JyL0/ jjiFWq8+pFzWWFPMjVZZ09ksMhRotc6Zdt75bj9uTZltcRfkbCz5exVcvWOMfGuS4pQ5 XcGLEitMVF+9NRe6vPrQNEY2xLI0kgmYIyp93En4RNVKRg6nP9ksKoxPBoW3PFMtDiDH o1puZaO/26tdm7tqZbhVTZ5N8sTnQUhCdMoI52I9H6QiBU2RDAEVGTUKItWmJs8eoppS kEdh3ZOn+NPEXjDAtyN4WJmpd5QcdptOi3IbYM3WVcqa0CUBNVfkCRI1cI6VBYpeMbcv COiA== 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=OkCxsTlC00EDzvrhbdDgWfXbky3OMtUImorHIIR3DR0=; b=c/BzLPCg5GIbmlwGHeNE4+s/wnBCrKgHDyXACcNVdL/WzV9ijNlOkV1cUHA04rPn5I pOlOPh/KHpxmP0CuzDgCZzMAc+J/xwC+c5S+/3XAVsWGDBeAHIpMoaXmboO3cq7BePuf z0QE47wS2ywCxp0EvFzJklDIW3W9RFH5SiU80iW3IQNccwzyGiQnVDvcLbvWdwAHuHS2 4s56qcRXw0gmtIAtgpT8I0+vX7xszzMvWkmoxCz2FV7ZXWdVW1Tbff+qEHs5lGOMxygF d7uWB73sbApRMT6zzl+OPDNZ/iEBQ8TFJux09a0rYhlmHeet8318kyWz/MAhUFS7tJCo xC7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LZNNjyh8; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 r11si6122978edt.118.2021.02.05.11.25.08; Fri, 05 Feb 2021 11:25:08 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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=LZNNjyh8; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S233437AbhBERml (ORCPT + 13 others); Fri, 5 Feb 2021 12:42:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:54090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233442AbhBEP5W (ORCPT ); Fri, 5 Feb 2021 10:57:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06A3964FD4; Fri, 5 Feb 2021 14:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612534168; bh=Aj+QZYVZsisjWj5TgF7rY1GnwJISHm0czR4ViQreQTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZNNjyh8A6f3Ykg2g6UhNrCaKu2UrY0YZlD985xtTvCdhX1tSRGoqMJWDtYeJQnww 3g/6HMLAk2hjfx37qFCQmqrueQaAGEZCzzBpK7SENBl+KStEKYP7RR1JlHsbU3kMDo J0eHGWs8vr7eQdUj91r7miE4+QSVcvIX8QbA0Olo= 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.10 14/57] arm64: Do not pass tagged addresses to __is_lm_address() Date: Fri, 5 Feb 2021 15:06:40 +0100 Message-Id: <20210205140656.592654124@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205140655.982616732@linuxfoundation.org> References: <20210205140655.982616732@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -323,7 +323,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);