From patchwork Sat Nov 16 23:47:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 11247777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28D1E138C for ; Sat, 16 Nov 2019 23:49:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECD6320733 for ; Sat, 16 Nov 2019 23:49:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mMXPqRUp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECD6320733 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org 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 X-Inumbo-ID: 7acc3c94-08cb-11ea-9631-bc764e2007e4 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 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: 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) From: =?utf-8?q?Marek_Marczykowski-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_Marczykowski-G=C3=B3recki?= , Jan Beulich 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=no-rs (by checking if efi_l4_pgtable is NULL - which is the case for efi=no-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órecki 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 *info) break; case XEN_FW_EFI_RT_VERSION: { + if ( !efi_enabled(EFI_RS) ) + return -EOPNOTSUPP; info->version = efi_rs->Hdr.Revision; break; } @@ -613,6 +615,8 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op) break; } + if ( !efi_enabled(EFI_RS) ) + return -EOPNOTSUPP; if ( (efi_rs->Hdr.Revision >> 16) < 2 ) return -EOPNOTSUPP; state = efi_rs_enter(); @@ -631,6 +635,8 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op) if ( op->misc ) return -EINVAL; + if ( !efi_enabled(EFI_RS) ) + return -EOPNOTSUPP; if ( (efi_rs->Hdr.Revision >> 16) < 2 ) return -EOPNOTSUPP; /* XXX fall through for now */