Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp835878pxu; Mon, 23 Nov 2020 05:31:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwofP9HHmxIc/uLdWPLKQ8kJur84H8Wd5V9OFeNvYTDiUNCzW+zIZfwR0p8OePL6l3OOKxY X-Received: by 2002:a50:c28a:: with SMTP id o10mr46279409edf.222.1606138278697; Mon, 23 Nov 2020 05:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138278; cv=none; d=google.com; s=arc-20160816; b=guICMgjw8oMt87QfPuOhpdcj4Wqko1opqu3tvjTCb+pIkuaqqY41jR3iUJzRizP3Ly cP7uoxpLCnp5lAm4Aq3pDZlG0Uu7BYVeUaxah+bT0jw/ArFb0IWba/p8LQZ5wMmzFc4o tbP/xKqK1Dl6j8fC2Hdrx6HmfZiJBPEUhU+vUqFR+3Wnz45RTpQhWiDrgZor+tsuVqyr PLiVSwqiT6jX+h/8aUEEkDNnFN8hQefNRvpzyew75AZqRxn7SVuhIOyE2aFhAWBVTO06 10lrSeBgvJkPbxTcf0pB6lLSn6JL2VO5Pm1WcdOOn7WNCvHxi6NKD151N46N5C2dbAUH Ztwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UEOje5TUjgPFdK8x57L6YuRG0Ro0Xiej/+hSrkLWE7w=; b=f2MNTNVoh1nbSj99Xz9JstTfvDk0Gj4yIcfsvqUXZkRZIRfORUtZq6NexKwHm8KDkD 4e6FIyeZ1Dsp0dqav5k+gmgiG0IQd02lqPHKYiJrNXCxPB33OjECI6MOuzwvA27FCgNB ScKpOULg+UkfPW249C5IDZtF2CRdYwiaivfUJLzBrVBl1UdGizuyi5GyyAeBJ56K3wgH ToWceKRyMy7OHCx6R7+CZE/NlcIRIsTn2q5eGXI6sabfK+IQTys6et30uZJG880deP79 NAU7itWACG98tiZlYQaCzU7XzqGC3lf1awluzVoSzAH3ZvdbgVZ92P/X3oPzx/hvU9Dp q/OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cKJwqC23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jt2si5160911ejb.552.2020.11.23.05.30.55; Mon, 23 Nov 2020 05:31:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cKJwqC23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730705AbgKWMam (ORCPT + 99 others); Mon, 23 Nov 2020 07:30:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:41548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730391AbgKWMai (ORCPT ); Mon, 23 Nov 2020 07:30:38 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B47D4208C3; Mon, 23 Nov 2020 12:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134637; bh=yDBmillITIeh+0Z2HXRpHRFZQiN1aSNucR1lA1ape74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cKJwqC23fvtctN0wajM0PRgW0TRkelu/HYVpfFroNu89ew2lBuY9AMmAxxu5i1Thk tENFXfnyJ3aU1D2o4w0G6X4Ar8ksQZQm5av9FwZBTJNyjaM8Zb+GROwuRT0gWyzCOM rR6L7ff6cLk8AghjV2AY5LtCKpFbIHPabMEhJ5To= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Lewis , Alexander Graf , Paolo Bonzini , Sasha Levin Subject: [PATCH 4.19 29/91] selftests: kvm: Fix the segment descriptor layout to match the actual layout Date: Mon, 23 Nov 2020 13:21:49 +0100 Message-Id: <20201123121810.742493688@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aaron Lewis [ Upstream commit df11f7dd5834146defa448acba097e8d7703cc42 ] Fix the layout of 'struct desc64' to match the layout described in the SDM Vol 3, Chapter 3 "Protected-Mode Memory Management", section 3.4.5 "Segment Descriptors", Figure 3-8 "Segment Descriptor". The test added later in this series relies on this and crashes if this layout is not correct. Signed-off-by: Aaron Lewis Reviewed-by: Alexander Graf Message-Id: <20201012194716.3950330-2-aaronlewis@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- tools/testing/selftests/kvm/include/x86.h | 2 +- tools/testing/selftests/kvm/lib/x86.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/include/x86.h b/tools/testing/selftests/kvm/include/x86.h index 42c3596815b83..a7667a613bbc7 100644 --- a/tools/testing/selftests/kvm/include/x86.h +++ b/tools/testing/selftests/kvm/include/x86.h @@ -59,7 +59,7 @@ enum x86_register { struct desc64 { uint16_t limit0; uint16_t base0; - unsigned base1:8, s:1, type:4, dpl:2, p:1; + unsigned base1:8, type:4, s:1, dpl:2, p:1; unsigned limit1:4, avl:1, l:1, db:1, g:1, base2:8; uint32_t base3; uint32_t zero1; diff --git a/tools/testing/selftests/kvm/lib/x86.c b/tools/testing/selftests/kvm/lib/x86.c index 4d35eba73dc97..800fe36064f9a 100644 --- a/tools/testing/selftests/kvm/lib/x86.c +++ b/tools/testing/selftests/kvm/lib/x86.c @@ -449,11 +449,12 @@ static void kvm_seg_fill_gdt_64bit(struct kvm_vm *vm, struct kvm_segment *segp) desc->limit0 = segp->limit & 0xFFFF; desc->base0 = segp->base & 0xFFFF; desc->base1 = segp->base >> 16; - desc->s = segp->s; desc->type = segp->type; + desc->s = segp->s; desc->dpl = segp->dpl; desc->p = segp->present; desc->limit1 = segp->limit >> 16; + desc->avl = segp->avl; desc->l = segp->l; desc->db = segp->db; desc->g = segp->g; -- 2.27.0