From nobody Fri Apr 26 12:00:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1556129597; cv=none; d=zoho.com; s=zohoarc; b=mPGva/nncyN+2GNiGUlJHEyYUeVTQf1jHcTsWgyx7Sln2OSIRNUCGwhzW3lxRKCQHojO+DQIzug3bJ43teLjG9W9QhRgR01MwazaGUuXsQYvF9PEClxVKlSxyD2wG6KhN30wHXq5tejXDW8yKTVFz6phS8hH6uIPbY7GMgs0Dfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556129597; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=HuumarPzdHh2ub7rbagsUimR0La95AEFje3KEJQi3+g=; b=YBNGKl55/GsJUgVohw3mG56kW5ZjJszBUvWWQiz/oKrvGtNQ8WnJaysYMbVQ10kotRmcw2BXpPolHguss52Tyew7v+3pu1+pRK7Lrp87g3dum/2UHmA8C3dGCMyz4rMCfJInnL3SOv2cojmoGUz6sMB6KytUOnP8be23ULAuFqM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1556129597676958.8645780723509; Wed, 24 Apr 2019 11:13:17 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hJMN1-000653-8T; Wed, 24 Apr 2019 18:11:47 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hJMMz-00064m-LA for xen-devel@lists.xenproject.org; Wed, 24 Apr 2019 18:11:45 +0000 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 6aea94f8-66bc-11e9-92d7-bc764e045a96; Wed, 24 Apr 2019 18:11:44 +0000 (UTC) X-Inumbo-ID: 6aea94f8-66bc-11e9-92d7-bc764e045a96 X-IronPort-AV: E=Sophos;i="5.60,390,1549929600"; d="scan'208";a="84328023" From: Andrew Cooper To: Xen-devel Date: Wed, 24 Apr 2019 19:10:57 +0100 Message-ID: <1556129458-11418-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1556129458-11418-1-git-send-email-andrew.cooper3@citrix.com> References: <1556129458-11418-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/2] xen/domain: Block more speculative out-of-bound accesses X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Andrew Cooper , Julien Grall , Norbert Manthey , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" c/s f8303458 restricted speculative access for do_vcpu_op(), but neglected = its compat counterpart, which is reachable by guests using the 32bit ABI. Make an identical adjustment. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: Norbert Manthey --- xen/common/compat/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/compat/domain.c b/xen/common/compat/domain.c index 88bfdc8..39877b3 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -39,7 +39,7 @@ int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUES= T_HANDLE_PARAM(void) ar struct vcpu *v; int rc =3D 0; =20 - if ( vcpuid >=3D d->max_vcpus || (v =3D d->vcpu[vcpuid]) =3D=3D NULL ) + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) return -ENOENT; =20 switch ( cmd ) --=20 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Apr 26 12:00:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1556129601; cv=none; d=zoho.com; s=zohoarc; b=mvFZCG1/Ch7RrbUKgG1C/LdsGZEM9X6BvfDHSAFiwFfFGf68iEdQ9TVT0Srm9ScTbkYINtlZdIkZMyaQzSl+7+7Zpkc3RIWqq/CdG/W/f9LAkMTnN0z+Ww3uDPZRMR6WrkjmlPQwMxB8rJSCww2PCR3FNOadEFx21szSUPFmWbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556129601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=whW32FPC3XxUSk11vS1W1wd25XUZcalrJWMy53X0bHc=; b=F3zT1T/6yf1LKkjEgNnxdi/tAD1e+xL6CQj3je7XUue++wWMlStmASNLWUXbUR/SYkurb8lhlvuDJ/q3j7gjpFNDmCzpGxSq68rcGmnw4aOkf6mJ9uHzeq4Nu/E6GzeZszLaATu5oFfDgtHcHCK5q81MspG0KoDo/eaToIUaQmM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1556129601648121.41389649858229; Wed, 24 Apr 2019 11:13:21 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hJMN1-00064x-0H; Wed, 24 Apr 2019 18:11:47 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hJMMz-00064h-Cl for xen-devel@lists.xenproject.org; Wed, 24 Apr 2019 18:11:45 +0000 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 6af740c3-66bc-11e9-92d7-bc764e045a96; Wed, 24 Apr 2019 18:11:44 +0000 (UTC) X-Inumbo-ID: 6af740c3-66bc-11e9-92d7-bc764e045a96 X-IronPort-AV: E=Sophos;i="5.60,390,1549929600"; d="scan'208";a="84328015" From: Andrew Cooper To: Xen-devel Date: Wed, 24 Apr 2019 19:10:58 +0100 Message-ID: <1556129458-11418-3-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1556129458-11418-1-git-send-email-andrew.cooper3@citrix.com> References: <1556129458-11418-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/2] xen/arm: Misc improvements to do_common_cpu_on() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Julien Grall , Stefano Stabellini Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" * Use domain_vcpu() rather than opencoding the lookup. Amongst other thin= gs, domain_vcpu() is spectre-v1-safe. * Unlock the domain immediately after arch_set_info_guest() completes. Th= ere is no need for free_vcpu_guest_context() to be within the critical regio= n, and moving the call simplifies the error case. No practical change in functionaltiy. Signed-off-by: Andrew Cooper Reviewed-by: Julien Grall --- CC: Stefano Stabellini CC: Julien Grall --- xen/arch/arm/vpsci.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c index 9f4e5b8..c1e250b 100644 --- a/xen/arch/arm/vpsci.c +++ b/xen/arch/arm/vpsci.c @@ -33,7 +33,7 @@ static int do_common_cpu_on(register_t target_cpu, regist= er_t entry_point, =20 vcpuid =3D vaffinity_to_vcpuid(target_cpu); =20 - if ( vcpuid >=3D d->max_vcpus || (v =3D d->vcpu[vcpuid]) =3D=3D NULL ) + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) return PSCI_INVALID_PARAMETERS; =20 /* THUMB set is not allowed with 64-bit domain */ @@ -82,14 +82,12 @@ static int do_common_cpu_on(register_t target_cpu, regi= ster_t entry_point, =20 domain_lock(d); rc =3D arch_set_info_guest(v, ctxt); + domain_unlock(d); + free_vcpu_guest_context(ctxt); =20 if ( rc < 0 ) - { - domain_unlock(d); return PSCI_DENIED; - } - domain_unlock(d); =20 vcpu_wake(v); =20 --=20 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel