Received: by 10.223.185.116 with SMTP id b49csp6407472wrg; Wed, 28 Feb 2018 08:55:34 -0800 (PST) X-Google-Smtp-Source: AH8x225jwYe9aJlI7HV9C3aAtcdCYzBysnRp02pmsF9pzgXy413UQvCS8Wv7ch6sb6cJev6bIcVw X-Received: by 2002:a17:902:6589:: with SMTP id c9-v6mr18428483plk.51.1519836934244; Wed, 28 Feb 2018 08:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519836934; cv=none; d=google.com; s=arc-20160816; b=gc/WS2Z/cZ0YyzTEeAcUByDnGuVr9bb/WBZjsofX4o4CRrrFJdRqRue4Bg5Rl+r+Sd JVJttD9QGMxGm5tclNjhBP9hUTn0hpAeyFsg/MH9J06gwdCGpUJF3Xp9RNzy94hnigOg cepJib8/R5ZAsl+Ns4pj7a3JppFExvqLFKl/C5jy8W4vQSe3kB7blDLoZAYJqumeoBPU AcUbSFtsbn43ty15z2hhSaQ9A5FvPZttSiggGK5YXsxokn2PSw9hVqC8fI+DQXaZRvwX DySiKwydzuNuLCeVc10giOu6JbWVTLzNdSbrUUWz0v6NOyquq6XpNuPKvDXzaVNS6XSk O56g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=r3sL36wFCnzPXCtW5cwhuUw+PAQZnKnqXh70oM07LW8=; b=UXYiHOI1u5UHcX0Ca4owjRwU25nWt69b+zNVjMWJ44/2w43PdPBcAbMQ/9SnJtPONU lxPBTFlldLJpNpXqQy2evkVSI95ebJFDwkvNIgeQx87h2iZ20cSCq/GzPlQNsB8LvvyT plJVzudmlkNMrV401uqW3KC88dBFrEZS2IB07W2RvqAFB022riuPDXPELXw5qb7A53GV avIAL/FKwhO7nBpUwCjuZEkTUHHJStP42BAGXfaXE2PQHsiV28pzEwu2CNKlOh2ZbMvs 6kj7F+soz9q0TjG99H5vgYahN4bjNlKoHPaYy0Sb3ztYsuZXA0VBLK1bXVnazhvdg9Bc qGGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70-v6si1521643ple.147.2018.02.28.08.55.19; Wed, 28 Feb 2018 08:55:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbeB1Qye (ORCPT + 99 others); Wed, 28 Feb 2018 11:54:34 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34519 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934092AbeB1P5k (ORCPT ); Wed, 28 Feb 2018 10:57:40 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yq-0006kw-2A; Wed, 28 Feb 2018 15:22:28 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yj-0000G0-Po; Wed, 28 Feb 2018 15:22:21 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jim Mattson" , "Andrew Honig" , "Paolo Bonzini" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 202/254] KVM: x86: Add memory barrier on vmcs field lookup In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Honig commit 75f139aaf896d6fdeec2e468ddfa4b2fe469bf40 upstream. This adds a memory barrier when performing a lookup into the vmcs_field_to_offset_table. This is related to CVE-2017-5753. Signed-off-by: Andrew Honig Reviewed-by: Jim Mattson Signed-off-by: Paolo Bonzini [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -698,8 +698,18 @@ static const int max_vmcs_field = ARRAY_ static inline short vmcs_field_to_offset(unsigned long field) { - if (field >= max_vmcs_field || vmcs_field_to_offset_table[field] == 0) + if (field >= max_vmcs_field) return -1; + + /* + * FIXME: Mitigation for CVE-2017-5753. To be replaced with a + * generic mechanism. + */ + asm("lfence"); + + if (vmcs_field_to_offset_table[field] == 0) + return -1; + return vmcs_field_to_offset_table[field]; }