From nobody Sun Apr 28 00:16:49 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=1573948145; cv=none; d=zoho.com; s=zohoarc; b=XZaSilFMdhNtdso7oYdFC7Hy9BqwvYexSSOkcIwjkv+OcuXnJw9GJRWA1bhxAG5lbDP0LcBzWUrJckxHOLNya/u8Y0UcW6eSzzNq/SzjGPd8l6AUfXg4Ix00HkQ1cO+Y42v9VoY/Y0tGchb//jCR9BUcIoYjUqAUli6crRidJr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573948145; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/6TrlDpeZdM/9QnTFax1NPJ3LUwYA2RLaSe+noE/ozw=; b=Y0RR6QuHDltMfdM+h/yTkW7/gPitT/kfTYhUMP8DP52pgW7d5Jofb+gX2N2/h9qSyca6ajKpdUHgpFsi5HTr6QYjj9Sqc5mFgKcVbSDJDrnR2aPJW9tDEHmgZWvvpdcwhZlyRSwj4M2uPuT/TDAJid4sXckuzlVdTlAR3nXJ770= 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 1573948145615549.0711905993824; Sat, 16 Nov 2019 15:49:05 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iW7n6-0005S6-IC; Sat, 16 Nov 2019 23:47:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iW7n5-0005S1-BP for xen-devel@lists.xenproject.org; Sat, 16 Nov 2019 23:47:43 +0000 Received: from wout1-smtp.messagingengine.com (unknown [64.147.123.24]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7acc3c94-08cb-11ea-9631-bc764e2007e4; Sat, 16 Nov 2019 23:47:42 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 1268A325; Sat, 16 Nov 2019 18:47:41 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sat, 16 Nov 2019 18:47:41 -0500 Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 654FA306005E; Sat, 16 Nov 2019 18:47:39 -0500 (EST) X-Inumbo-ID: 7acc3c94-08cb-11ea-9631-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=rhYJEy //Z1zO+nCuVadJpb11s1YaB1WF1kFYupP/SyU=; b=mMXPqRUpTMFFdB04Vxj20g p7gRzlGyK1FBD2zx8x7n7jpaSgFl8D3poCuw9F3V8GJYNVR8mWkjDr8Afwk7lC3r 0sp1o2aDBBENioscVltva2VETgmxVshEv9TlHG6pQVYK6yoh8oCy4o1FO327fZYb K859T0JSlkDBMnGKKht6dumKrYkZaEA/mameHZ2T/DC+JdsrpGyWgXE2M3h0Ru/R nXQcS3v+wkOj4OGsqTDefB710MXxMDZ+bhYo7z15yJbLGTosknswNyWmUtBDoFjX AOg3kPQLlKv0KOmNbxODWpkAoD5SBSrbhchYWg9HTBNJp6haFi+fSvZsqiYwamRQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudegtddgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffogggtohfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Sun, 17 Nov 2019 00:47:16 +0100 Message-Id: <20191116234717.1458-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Organization: Invisible Things Lab Subject: [Xen-devel] [PATCH for-4.13] efi: do not use runtime services table with efi=no-rs 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: Juergen Gross , Roman Shaposhnik , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Before dfcccc6631 "efi: use directmap to access runtime services table" all usages of efi_rs pointer were guarded by efi_rs_enter(), which implicitly refused to operate with efi=3Dno-rs (by checking if efi_l4_pgtable is NULL - which is the case for efi=3Dno-rs). The said commit (re)moved that call as unneeded for just reading content of efi_rs structure - to avoid unnecessary page tables switch. But it neglected to check if efi_rs access is legal. Fix this by adding explicit check for runtime service being enabled in the cases that do not use efi_rs_enter(). Reported-by: Roman Shaposhnik Fixes: dfcccc6631 "efi: use directmap to access runtime services table" Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jan Beulich --- Cc: Juergen Gross --- xen/common/efi/runtime.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c index 22fd6c9b53..12da6a525a 100644 --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -211,6 +211,8 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *in= fo) break; case XEN_FW_EFI_RT_VERSION: { + if ( !efi_enabled(EFI_RS) ) + return -EOPNOTSUPP; info->version =3D efi_rs->Hdr.Revision; break; } @@ -613,6 +615,8 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op) break; } =20 + if ( !efi_enabled(EFI_RS) ) + return -EOPNOTSUPP; if ( (efi_rs->Hdr.Revision >> 16) < 2 ) return -EOPNOTSUPP; state =3D efi_rs_enter(); @@ -631,6 +635,8 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op) if ( op->misc ) return -EINVAL; =20 + if ( !efi_enabled(EFI_RS) ) + return -EOPNOTSUPP; if ( (efi_rs->Hdr.Revision >> 16) < 2 ) return -EOPNOTSUPP; /* XXX fall through for now */ --=20 2.21.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel