Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp31220imm; Fri, 21 Sep 2018 17:28:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV63gvAbqLXt/b4oMs9q3OvS9AkqOEcGdUHWx66n4YQvJAUnevM8Zoaj0s2a04XlZgdHNIVV3 X-Received: by 2002:a17:902:d90a:: with SMTP id c10-v6mr121802plz.35.1537576088202; Fri, 21 Sep 2018 17:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537576088; cv=none; d=google.com; s=arc-20160816; b=Qm5ENgYFqdj5zPMCXWW28bRjfA/WRl7FNukzY5WdJV5+KeFU0BrXwcCICKgeRC/Nyr /892aVgUn0mJxmtbCPAGPm8R5FPay9riXuxa+y5fKLdIPPtTaCKkcK6OjK6Qt5ga13kg aKr6k4v6FNx3MK2d3VlH1Kq8bVvKXyWej72aQPAabzNU3ZvmuwSfKFoXTNo3H/ZBc+Bc rPK6YvyXtiOISpKIKs1kloP2t9wzoeqH+GG7S0rDQNTgn+zirq0IYaXeDPtBJYlz5n0q HOlbVeiOjyamV303gmEssXapOOLKp9YrJsWvt9ygnv4Y8kq6JJGmCBwLmTWtEkJ/Knw9 Oi6w== 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; bh=gvQDE+vlRU9w4tgXU5Qsh+QiTFW4sEyRuk5XumzK5C0=; b=hnPDdMq8+ojzoCQx82pwP0OmnkfDAq4kvuhp3JL4MZZphC7vyj23d7urn4WBU5gf8A HS+Zus6+0rYGQv73rNAl2SmeKkvMhWgSVLOvX9W3A43XkoG2j6y1ixqJPBJUDNzVXls/ 1g61UcTvmVz71z19TPZXyZlAordDhhHQe48wskruI3U39/ZjNKRYjJAGOkTXbVDNFtfv VvdC+Z4IqCXTBat3dNWm/ERHiq74X+rV5a9H+MqjveAl1EzL51ZUBXAcVKLRqxLVafkN s+ViYQZMjIEzvMUzPum5KbIC9h6kTHEA9MoTLCoNn5a5o7MrR93d92NqI/yrOf0izj7G CwUQ== 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 g5-v6si4696515pgf.565.2018.09.21.17.27.53; Fri, 21 Sep 2018 17:28:08 -0700 (PDT) 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 S2391905AbeIVGKn (ORCPT + 99 others); Sat, 22 Sep 2018 02:10:43 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:44082 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391849AbeIVGKm (ORCPT ); Sat, 22 Sep 2018 02:10:42 -0400 Received: from [2a02:8011:400e:2:cbab:f00:c93f:614] (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 1g3Vds-0008BZ-Mr; Sat, 22 Sep 2018 01:19:24 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1g3Vdn-0000ql-GV; Sat, 22 Sep 2018 01:19:19 +0100 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, "Nadav Amit" , "Paolo Bonzini" Date: Sat, 22 Sep 2018 01:15:42 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 14/63] KVM: x86: Emulator ignores LDTR/TR extended base on LLDT/LTR In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:cbab:f00:c93f:614 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.58-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Nadav Amit commit e37a75a13cdae5deaa2ea2cbf8d55b5dd08638b6 upstream. The current implementation ignores the LDTR/TR base high 32-bits on long-mode. As a result the loaded segment descriptor may be incorrect. Signed-off-by: Nadav Amit Signed-off-by: Paolo Bonzini [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- arch/x86/kvm/emulate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1467,6 +1467,7 @@ static int __load_segment_descriptor(str ulong desc_addr; int ret; u16 dummy; + u32 base3 = 0; memset(&seg_desc, 0, sizeof seg_desc); @@ -1597,9 +1598,14 @@ static int __load_segment_descriptor(str ret = write_segment_descriptor(ctxt, selector, &seg_desc); if (ret != X86EMUL_CONTINUE) return ret; + } else if (ctxt->mode == X86EMUL_MODE_PROT64) { + ret = ctxt->ops->read_std(ctxt, desc_addr+8, &base3, + sizeof(base3), &ctxt->exception); + if (ret != X86EMUL_CONTINUE) + return ret; } load: - ctxt->ops->set_segment(ctxt, selector, &seg_desc, 0, seg); + ctxt->ops->set_segment(ctxt, selector, &seg_desc, base3, seg); if (desc) *desc = seg_desc; return X86EMUL_CONTINUE;