Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp705720pxk; Thu, 24 Sep 2020 16:51:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgnnxnKYmvie/WyDdL9agNMPq4h/DZ5QMcdcKJ1bp7H7EqY6lAv6xsihCd9zXg+ALMQTBY X-Received: by 2002:a17:906:e4c:: with SMTP id q12mr68274eji.425.1600991508730; Thu, 24 Sep 2020 16:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600991508; cv=none; d=google.com; s=arc-20160816; b=eK5jiUCNAEzg7kdSyPmB1XH70s5Ktf/EisPv8JQp9RFD6EQuaggr3DaDwohfc/aIsH niNFxXCPGD6XiGJxnfr8sWys8qki/Y1AV+UrOCe9/LIqOsYkTnpJlcsUQslV6DsSbDnu xKG5Ih/eTS7WEzOgwAuwi0t/2UI5Xs+eIJP3bHzliDIKXGQ9Z8vqBqUiBFf7nh1ow8ev NkCrKwHXoCOfgKYkzeElHutctZbwFaUilddNeLClh4BdQD8jS+6X7uCCjYGrbf3wwjbO /8ZjXvswN0Vwu9yUiH8TiZluB00d2yfuyrzaDA4Sngv26eTnTm/WZ4d2Q2d26iDt4hLg uS0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=Q3y38MEPfZDoaIcGjPbrbGlr0TCIWulJSLzTSKxqsrk=; b=mWW3B3gWjleVtsICCvUdfOoaCa1LEinQu/kfPccPWmTK61EOAMaUsO5losvxiGyKpv rr4t1PSf7I9G7ir0sJz9PleAyY3CHuWKj3lwWGIXDFLfsJ/oPDZAtf9somsnh89Cf4Fu z2R1HZ1Jn+t3qrRmVvhZnasoPUtPnxV6ko8iIdb/2x3TtWluiWURlBWAQFOVxbUhVPT1 kcLIo+W4LxcJ2PYG3lKe7MnZWvnqikdLcbMmVSMfQNl6fffx7nHZlE70uYYUbJeo3Yg9 LtSGzpZ+lQ7W12g48dLawdsHOvPXXtBGqMltZhBQT3gUNSLmwzHnWjSK7h1TF1ilCfma +BsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ibTGX1WN; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si761821edy.300.2020.09.24.16.51.25; Thu, 24 Sep 2020 16:51:48 -0700 (PDT) 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=@kernel.org header.s=default header.b=ibTGX1WN; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbgIXXt5 (ORCPT + 99 others); Thu, 24 Sep 2020 19:49:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:59732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbgIXXt5 (ORCPT ); Thu, 24 Sep 2020 19:49:57 -0400 Received: from sstabellini-ThinkPad-T480s.hsd1.ca.comcast.net (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D590F239EC; Thu, 24 Sep 2020 23:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600991397; bh=fRW1ZHqPHqZ48BxIvmHLvJMqcd/CjP5KGt6za+X8upo=; h=From:To:Cc:Subject:Date:From; b=ibTGX1WNRLvzLVxqQjXiWejMwgm0qp2FymbUjSI03Q6aCiLjE9B2v9kYJbja0qvDZ dnlMXblBKt6KiV6m/4tIdKFIvqtAegPLT7cMK5iLBXumckmutbIIPngVVVGazfM1Fz QOVhwEVae4X2Qo9X67C2d2B2KeK8lqXZGhN9/Oqs= From: Stefano Stabellini To: linux-kernel@vger.kernel.org Cc: sstabellini@kernel.org, Stefano Stabellini , Bertrand Marquis , boris.ostrovsky@oracle.com, jgross@suse.com Subject: [PATCH] xen/arm: do not setup the runstate info page if kpti is enabled Date: Thu, 24 Sep 2020 16:49:55 -0700 Message-Id: <20200924234955.15455-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefano Stabellini The VCPUOP_register_runstate_memory_area hypercall takes a virtual address of a buffer as a parameter. The semantics of the hypercall are such that the virtual address should always be valid. When KPTI is enabled and we are running userspace code, the virtual address is not valid, thus, Linux is violating the semantics of VCPUOP_register_runstate_memory_area. Do not call VCPUOP_register_runstate_memory_area when KPTI is enabled. Signed-off-by: Stefano Stabellini CC: Bertrand Marquis CC: boris.ostrovsky@oracle.com CC: jgross@suse.com --- arch/arm/include/asm/xen/page.h | 5 +++++ arch/arm/xen/enlighten.c | 6 ++++-- arch/arm64/include/asm/xen/page.h | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index 31bbc803cecb..dc7f6e91aafa 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h @@ -1 +1,6 @@ #include + +static inline bool xen_kernel_unmapped_at_usr(void) +{ + return false; +} diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index e93145d72c26..ea76562af1e9 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -158,7 +158,8 @@ static int xen_starting_cpu(unsigned int cpu) BUG_ON(err); per_cpu(xen_vcpu, cpu) = vcpup; - xen_setup_runstate_info(cpu); + if (!xen_kernel_unmapped_at_usr()) + xen_setup_runstate_info(cpu); after_register_vcpu_info: enable_percpu_irq(xen_events_irq, 0); @@ -387,7 +388,8 @@ static int __init xen_guest_init(void) return -EINVAL; } - xen_time_setup_guest(); + if (!xen_kernel_unmapped_at_usr()) + xen_time_setup_guest(); if (xen_initial_domain()) pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier); diff --git a/arch/arm64/include/asm/xen/page.h b/arch/arm64/include/asm/xen/page.h index 31bbc803cecb..dffdc773221b 100644 --- a/arch/arm64/include/asm/xen/page.h +++ b/arch/arm64/include/asm/xen/page.h @@ -1 +1,7 @@ #include +#include + +static inline bool xen_kernel_unmapped_at_usr(void) +{ + return arm64_kernel_unmapped_at_el0(); +} -- 2.17.1