Message ID | 20241009154953.1073471-5-seanjc@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8197ACEE329 for <linux-arm-kernel@archiver.kernel.org>; Wed, 9 Oct 2024 16:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=x0cgmo92qPc8MR1y7gAJGg1sCyN/CNSLMfDMg1eW/5U=; b=mvN3B6LvbvkBWYFZdXNzIj3387 BxX//SnjLCsDmTHt+elbAmCVm3cvvRLqyYOUTECMKOcvpy+bCOXTDVOWnwzz0SFTvBJr3ufej8Iwg 9rg92bHFETaBAaQz8hWHQiDq9Ox7P8vpYSYgikDu8QN4L1PFRSxc123nXxctyVTR4dP/J2U6bz77v vB9Cb/iB6lVaMpPr3FmaxemO4uef/WDQuXJf/OnkEQNp5uQuoH4EcwIQEcGjef/ruG6cGUhm1VVoP lsyCRJ/FhRcQ11pGcXPKQBkIrTWCxLgPDCyb+sszBWqgVtTmDiHqyD0eUm3I6kws+l1sqBPBIYHd6 HI1jDwxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syZ71-00000009qLx-38mv; Wed, 09 Oct 2024 16:00:31 +0000 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syYww-00000009o4Y-0J8h for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 15:50:09 +0000 Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-71e1ed58e9bso1071907b3a.0 for <linux-arm-kernel@lists.infradead.org>; Wed, 09 Oct 2024 08:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728489004; x=1729093804; darn=lists.infradead.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=x0cgmo92qPc8MR1y7gAJGg1sCyN/CNSLMfDMg1eW/5U=; b=v+PyAs7xiXW4JO4mkqRxca5B0uiPlhu7vlTcAcClWxQSiwpRYSNrqd2aMjIceW6lyE BSEhb33/syvmGwMTEj21gasth9MqjcxaWw1k2p+ILICHT3bjkQYDWv1K8aMEWKOY0WJk qZBRoYFfJ/TnX2h1+slwVUJVh/pma1Ve3oInfATojFO68zYRmcRFdQvbUyC156ZsROpZ 8gYvmQlmjikDmsALjECund8ccEIFi7QEL3noF8/t86Z22f7wXdu6OKdXDPodr6JmQzPO qV+ND6wRejh0cwSuKNcMfmm26Ez6KcpfTXk+FiZZSljPT/FAsjvSSqoL765HJgvOTDN/ tJNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728489004; x=1729093804; 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=x0cgmo92qPc8MR1y7gAJGg1sCyN/CNSLMfDMg1eW/5U=; b=QUoTHh4gBCNlpZDEkOhxFRMemJSpY/8n+ROI9yW3WdiqJjqYrmz6GVfiCnveS8M0IT BGR9fn1pDaAvNJqsqyNoBOMeJPBHj2lGRPhwLcTVtzw2qGWBJA2qQyfWuHoWUxh7FjkE aI239PPB9DNNAPrpRDAlDoQXAj6QsZd0Ex/nUdz5FOVK1gel3WP/IeojeMYW81r6903X x0QulROPuIDMEoanFwBjlqbLl+vAMvDgIriVJJOx5aBiHHJSqKK3QaxmCYorE4/PlN70 vvROoYRxNzfSJpZKStaY0dU2+L+b8mUeiNxNBG1kY9UzXnHV8tPD0uU8KlnYziEIU5RT DT/A== X-Gm-Message-State: AOJu0YxPRoYsSCc2ns0mYlSz/1SwaGDt7kw5DzDgA9Dw2opHMclXDGA2 j8wQU7Ov3QoJCqWOLW+XpH3CFjZSBGcwzA7PpigFvHh9lWJdXSpNtWl0f10bzPr36m8v3ukq84j euw== X-Google-Smtp-Source: AGHT+IERUBPfneULnJ59z0o0A04D0VCwsGKXUdX4SfWVGxtKdYKWNTs8AEtFgRMkbcfSQG42khoM/WAQWlQ= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:a05:6a00:4fcf:b0:71d:fb06:e79b with SMTP id d2e1a72fcca58-71e1daa9410mr6141b3a.0.1728489003716; Wed, 09 Oct 2024 08:50:03 -0700 (PDT) Date: Wed, 9 Oct 2024 08:49:43 -0700 In-Reply-To: <20241009154953.1073471-1-seanjc@google.com> Mime-Version: 1.0 References: <20241009154953.1073471-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241009154953.1073471-5-seanjc@google.com> Subject: [PATCH v3 04/14] KVM: selftests: Assert that vcpu_{g,s}et_reg() won't truncate From: Sean Christopherson <seanjc@google.com> To: Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Paolo Bonzini <pbonzini@redhat.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Janosch Frank <frankja@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com> 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, Sean Christopherson <seanjc@google.com>, Andrew Jones <ajones@ventanamicro.com>, James Houghton <jthoughton@google.com> Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_085006_178727_D9F5EDC6 X-CRM114-Status: GOOD ( 10.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Reply-To: Sean Christopherson <seanjc@google.com> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KVM: selftests: Morph max_guest_mem to mmu_stress
|
expand
|
diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index 287a3ec06df4..4c4e5a847f67 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -707,6 +707,8 @@ static inline uint64_t vcpu_get_reg(struct kvm_vcpu *vcpu, uint64_t id) uint64_t val; struct kvm_one_reg reg = { .id = id, .addr = (uint64_t)&val }; + TEST_ASSERT(KVM_REG_SIZE(id) <= sizeof(val), "Reg %lx too big", id); + vcpu_ioctl(vcpu, KVM_GET_ONE_REG, ®); return val; } @@ -714,6 +716,8 @@ static inline void vcpu_set_reg(struct kvm_vcpu *vcpu, uint64_t id, uint64_t val { struct kvm_one_reg reg = { .id = id, .addr = (uint64_t)&val }; + TEST_ASSERT(KVM_REG_SIZE(id) <= sizeof(val), "Reg %lx too big", id); + vcpu_ioctl(vcpu, KVM_SET_ONE_REG, ®); }