Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3393870lkq; Mon, 23 Nov 2020 04:42:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPsYp06GUY8jxP/4/vTskNXlGsj6Lb51jhCVPfJRJxnSLLS2pLglfcf3cqvC4y5I3SrEXN X-Received: by 2002:a17:906:5910:: with SMTP id h16mr21863734ejq.60.1606135342483; Mon, 23 Nov 2020 04:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606135342; cv=none; d=google.com; s=arc-20160816; b=Fs0XrvnW3oZfDQTOMw8dGvx+fEVsuWlOOs2DqmUKfmqLEvkItck94luQEj5cKF2eu6 JfU3YlpoInWlMZhR5aMl72Zu1NrrBTD8mgtaZQF+mOW3C05mkUN3Dm1xDKh0TGtl1t4G y5TIzbzaSCykfrFgY0C/8tKNjdrs1JcoliUdH1xUlT2yIg7Oh8eWmZcp+CnAiG3ZBeXU FlGadKSDNLaTbm9ziAXvUBXo/0hECE71xqWf5I0yGL3ae52ZptsS9EQg55Jwr4j8iySE CsW0if7IMiYFwjoGq9REv9M2S89nxZTt5cuCVyO96GZ2CZgEKBI3yPVhP3QYv2D+98zm u0yA== 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=feQohO9vuwJFoGvGb6aTynN3UYqY23MX6zjbKkdr7mw=; b=bxCYEw5v/luM9CErA+xmHaczYSfNDCiimYey0gb+6jzUWsghO+7datxZis0DaI0z0y w2FBMwOJOjB38Q5JpGfeoiBkq4KApPOWIz7QGyQPI3fEG2d2Zkc5GtZKI25RU34gEBTT yrRIuUiAtLpNiBqS9kGHbmIZyxXpVHhlLZwoOhjhr3E2ISxDjW4cmDH9aQcFgZQ0Go6Z 4c1bZtLt2Tm4pBXwYKfUTCpPxq5ddrnjEY6jF+6t13phY5zZkJHmMsJM1jpQdOVwlByH Q6R97rlGlnH0aVl2NuPwCFK8CDJAuxMkOHvMwsCkxuzCn4yeWkVDSY/LVe4yNwcXchpn pPLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EfSMS7Ak; 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 ec4si6331000ejb.549.2020.11.23.04.41.58; Mon, 23 Nov 2020 04:42:22 -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=EfSMS7Ak; 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 S1730623AbgKWMfN (ORCPT + 99 others); Mon, 23 Nov 2020 07:35:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:47142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731487AbgKWMfJ (ORCPT ); Mon, 23 Nov 2020 07:35:09 -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 1C4B62065E; Mon, 23 Nov 2020 12:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134908; bh=qA9fL4rqujlpZBdsl3uGA3WgnfkXV4SHUiZeGzIiW58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfSMS7Ak5z14eZeIOJ3qJ4i3cNFkUMTcm+I+oXyCbzZXv8t4KcARsfXQ9rOLwWKr1 GfpkOtALY93XYboKtj+NY+VhE6J/ppGfCyIvZtBruCEnrqhOpdkW7YYuulQJpdAyBP LKBReFDsi6GGOH3bLb8z0t/ZfYLKdmqxtbe0q8BI= 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 5.4 036/158] selftests: kvm: Fix the segment descriptor layout to match the actual layout Date: Mon, 23 Nov 2020 13:21:04 +0100 Message-Id: <20201123121821.677400596@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@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_64/processor.h | 2 +- tools/testing/selftests/kvm/lib/x86_64/processor.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index ff234018219cf..aead07c24afcf 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -57,7 +57,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_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index 6698cb741e10a..7d8f7fc736467 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -446,11 +446,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