Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp444863lqb; Thu, 14 Mar 2024 16:32:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4yIA3P0tD3BUvmVvM6kY832BJa0ThTZ5CKjHbUZ6aV/DcPXkk3KbVmKds6TkAkJoZiT0Ez9OBfqhk7z/ligSZ0Rcaj0pImbtCYRlC9g== X-Google-Smtp-Source: AGHT+IHSx/+IG73hJOM770X2poDRKc1oIkZwVrstXe13wVG39b4fLB3OlKtWjKCTljO/037Hylj8 X-Received: by 2002:a05:6808:3a17:b0:3c3:778d:11ea with SMTP id gr23-20020a0568083a1700b003c3778d11eamr105208oib.13.1710459133038; Thu, 14 Mar 2024 16:32:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710459133; cv=pass; d=google.com; s=arc-20160816; b=JTqqxxYgZFrdApJFSayNQRLiKzb0y9v8VNT0vO+jDorqZoVT4tIUKzjikzDF23FXkP 5nyISGdLG0/qiXfM5HaiDHo7O77Ux0Tj915lPXim4bk2OhaHI4AsFeB4copZP9yxq2KU XZxEhCG+o6t+4DMnhAgqt5Kd+IS34bVjROR3Avd4HLewxnzn4RVkFqzx2kPEqEonVNKq 7T4OW7+x6L1KRe5kLkaHB7Z1kpmduZQnHyeCeOp75ZSup3wh4Me9XHSzvEfLZgkTKZdv hrQ3zcxgIQM1FjtCIHIriClixbWLE2BdvgJoKObUbYt1FeFHd6wtzMCcjeN0ESx0GM6g 6oCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=f7mdClvgIXUuf9+yuKM3CelLdMACw57Fq4PBdMk33ZU=; fh=v+/BVmJithmtldyz1YQe5yNSlHrHYctygXAiqjcx0Ws=; b=DbQ8NTuRsK6CSRjDMYwAcb/Y0E9T0JZSVqKAlUvx51zuyuvRXg9/r7c5M/TkSlcr2u mYIk8XlNEvEpiw4s3sNfyfaVKjU6w3m2ETub0caIx6cdwHRaLmn1v4l0iSyLnYExw411 PALXZHai5uNfRdrUDmXP123408jmL7pPa1ge8i2nyj4TmCW+/2hoqNw4XMgzR6/bdtVL DpK1bRW5hPQ/kcZpPNeanV9gOhwD4f9CRs15cjIMp0KmIklgKQZ63/8pP1N5MRusCg88 weIyx319IkWQGI3z2DOl/n6hresl8cOfVbiO8+uvLS/xwqK/Rvzi/QNHJAp3AQPKuwNs GtLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3BBKRojW; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-103896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iu8-20020ad45cc8000000b0068fe4f0982fsi1690310qvb.156.2024.03.14.16.32.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 16:32:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3BBKRojW; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-103896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BA29D1C20E61 for ; Thu, 14 Mar 2024 23:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FF9E18AF9; Thu, 14 Mar 2024 23:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3BBKRojW" Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC31318026 for ; Thu, 14 Mar 2024 23:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710458809; cv=none; b=aLF1hsmPLP2oB4IVFXsnudiHrKEnGpGvEV55q/7QdBkb9eiWYWccb8U96WPcxA6T/YQcARkY3cFk0UczwmFvpExh5CAuRZ7OWZzR8z4x+uyz//CMi7wTi/vOMLxWoCIOLZRVRntfsdeDgZP+hfB2HjikWjUJn05gwrKthkSieDE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710458809; c=relaxed/simple; bh=hVROtGdDjNDokjJTyibuSKcjvmcYXHYDj2oTedDMiks=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Z0rMFq9NAWtPfci5MBJ0uQN1eMT0XibBK3M1zPng9juHGGXGHjf2lRgYPw3NqTaCTZ/JPEG+7xm5hEq7BMU+KSweNR2vrJhh6QoxIOtfaWfe4T2ZYIqkwNAy9/MT/pQxXBRbnKpbKTkvXBXcL6BK8dHKmh0HbgIZF0l1lPgA6ic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3BBKRojW; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-6e6c5b1377fso964436b3a.1 for ; Thu, 14 Mar 2024 16:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710458807; x=1711063607; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=f7mdClvgIXUuf9+yuKM3CelLdMACw57Fq4PBdMk33ZU=; b=3BBKRojWR/jRYG1n/FKYWL5/dqIp5HYlcuoZneAhJoUI68SBSUM98/RfD26Taft5bx +ga/ChJEKn5Zg3O/EChjn7e2tUpWI5MGpCWsOaHxfUhbOuYTP3KfEO6IvsdRZdNUDcwb we6eiHAn2YrDnyE8g/NLOr6Rn8wdz158ZQGEBI4vefEa2vA3ViHgorXE3GFVztaUOXRs 34UNS3o+6zVZFCf1C4R7VzgU2XWkJKu/Ye9JJfTqxLLrNw4+i5f27yUiq8iwm4JlmFgz cFfbrtIKYkE2mww5pjA8tW+q0WGwazOz+GD1QI9Yd8F2nnno6ySRdvwSUA3vtpubhMZy YGwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710458807; x=1711063607; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f7mdClvgIXUuf9+yuKM3CelLdMACw57Fq4PBdMk33ZU=; b=Z+SJmsSSQcvh01l4JLNXw74Qm46uDNwcpG/OMRNL4xM9Yk3iLRoLvijgvVI7x7Bvla HuX2S0KnZaGGjPTyxcJ/tXpo1yZ8cXEdaj7qKfxOgBVtMpPsoleDvPr4PaKSVec7T3NG nepbDOuZNrsRL8E2PdRDcr4WFp3kSJUw4MXfD/QsPzYUbW8WHTxmsm3UD28iX0E54ePF z4qN9K+HBFd4R9Wi8fd2vf+KPCRGnECFSkLgUEhrJ8kaz94lCHiWu0Fe1AxN1nHvooD0 +8aYqALMJaMkrBaGhu4u0C1JBFCIMef43N8UlhJkHXQDHw9M0Uab+u8KqmXiEBn6O/bn bsXQ== X-Forwarded-Encrypted: i=1; AJvYcCWEe53GnXHusytuwRl+MFHw2c9Bln4eK0RmXQwmexRa5abFz0s7PHVxNP8JQEABx7yc15to2VKoh/rVvamj1gQ6JCkW+WHIsaXEa/6K X-Gm-Message-State: AOJu0Ywk9/Y5dnD1BCBWk+eRcfOKaMNwZm9QuQ50lmVozYHlsdwqBZIn NmPaOUOOvzQTCl3sI0a6XLjT/0GmT8bjGtohfra1ZJKlXpd98miRjTXrIHO1PYWsD4HnvAd39UA 0mw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:1a:b0:6e6:eefe:945d with SMTP id h26-20020a056a00001a00b006e6eefe945dmr9863pfk.0.1710458807233; Thu, 14 Mar 2024 16:26:47 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 14 Mar 2024 16:26:23 -0700 In-Reply-To: <20240314232637.2538648-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240314232637.2538648-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.291.gc1ea87d7ee-goog Message-ID: <20240314232637.2538648-5-seanjc@google.com> Subject: [PATCH 04/18] KVM: selftests: Fix off-by-one initialization of GDT limit From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ackerley Tng Content-Type: text/plain; charset="UTF-8" From: Ackerley Tng Fix an off-by-one bug in the initialization of the GDT limit, which as defined in the SDM is inclusive, not exclusive. Note, vcpu_init_descriptor_tables() gets the limit correct, it's only vcpu_setup() that is broken, i.e. only tests that _don't_ invoke vcpu_init_descriptor_tables() can have problems. And the fact that KVM effectively initializes the GDT twice will be cleaned up in the near future. Signed-off-by: Ackerley Tng [sean: rewrite changelog] Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index 45f965c052a1..eaeba907bb53 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -522,7 +522,7 @@ static void kvm_setup_gdt(struct kvm_vm *vm, struct kvm_dtable *dt) vm->arch.gdt = __vm_vaddr_alloc_page(vm, MEM_REGION_DATA); dt->base = vm->arch.gdt; - dt->limit = getpagesize(); + dt->limit = getpagesize() - 1; } static void kvm_setup_tss_64bit(struct kvm_vm *vm, struct kvm_segment *segp, -- 2.44.0.291.gc1ea87d7ee-goog