From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE3F8C4338F for ; Thu, 29 Jul 2021 12:49:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A26866018A for ; Thu, 29 Jul 2021 12:49:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A26866018A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m95TE-0006Pk-NL for qemu-devel@archiver.kernel.org; Thu, 29 Jul 2021 08:49:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m95Rb-0003ac-C8 for qemu-devel@nongnu.org; Thu, 29 Jul 2021 08:47:23 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:36804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m95RZ-0007Yc-Tf for qemu-devel@nongnu.org; Thu, 29 Jul 2021 08:47:23 -0400 Received: by mail-ej1-x62b.google.com with SMTP id gn26so10528664ejc.3 for ; Thu, 29 Jul 2021 05:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h0gR4If4geV9J8dvQ27wXatAz2EbMix2f+K8mxX0nUg=; b=rIfm+F19ZosTrXNQwW0nF4n2+fV56ShNim36QsqNzOOHvUvvz47DsA3+IbROSzajkc uvJtVU0GfYzg3QyiU0UdUd+ENNB7euFYldCzqQohZxUjm0TVxlbCNM4kw0dlakkoYjBh hDVSOkRIJQRUKY9q3c/78rzEVaYOSyZD/kklvBWTtc4Xg4i5g3WBkzGSK4Alc68uQgLa 8DpNRatFcGJzMaDgdEpEaCNaCyULNGx4IBCabrSXpkZVV0tfq61IOPRmuKkOQpPbcrM4 P7nmbv3IfUSxUC2h7EMKnUFN51EU7kBQWDO6x1oXG3E/GcCvuwXCV/DtgBVWHZPwVJ8g H4Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=h0gR4If4geV9J8dvQ27wXatAz2EbMix2f+K8mxX0nUg=; b=mCKyOWBiZsneYHlFofIgWJTFpmCg1ZGUmuAtVKY7plpABDy9n/1GMcumi2tUIK4Rrl 6GV+aCMZOguyIyrK/HVx2C5IhGMb11bilQQYIf5R39C2n/fo+qaQAXGeLXFl8EiuhapN KOZEV8E2Bw0lKXV239tmn9Z24JODs5IKLX8YM2PsRsDcYrpE6dwwlyPCe2DIHCbrNIqh eKmjXfSZTGG3gJ+EtYt1OYqV0Ptk2h5lg1gvSMtRMevUdnokFgzL6IkVlkMINmbU6fWK jiOxXAxeNBqMuwQb0YIR+GR1qnw7DkZcXoxsTyr8NALYUGq/pbzgoSIzOKDs/mL/h44h rMug== X-Gm-Message-State: AOAM530x4lIa84EXlnJg30fYJouAwXrj7mQjybnRQd7T8qGkftpxTD3N f1pnzx8Tx7419GcHki3+hNP4m4QHZKKixQ== X-Google-Smtp-Source: ABdhPJyV2iVbYqccTFnx03KiwCK+JDBuP9/fAZdM9qQdpUJnw6cv1zihygzxbeScRGGauof+cJ/cPw== X-Received: by 2002:a17:906:af02:: with SMTP id lx2mr4290699ejb.133.1627562840656; Thu, 29 Jul 2021 05:47:20 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id m12sm954659ejd.21.2021.07.29.05.47.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 05:47:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 4/7] target/i386: Added consistency checks for event injection Date: Thu, 29 Jul 2021 14:47:10 +0200 Message-Id: <20210729124713.208422-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210729124713.208422-1-pbonzini@redhat.com> References: <20210729124713.208422-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lara Lazier Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Lara Lazier VMRUN exits with SVM_EXIT_ERR if either: * The event injected has a reserved type. * When the event injected is of type 3 (exception), and the vector that has been specified does not correspond to an exception. This does not fix the entire exc_inj test in kvm-unit-tests. Signed-off-by: Lara Lazier Message-Id: <20210725090855.19713-1-laramglazier@gmail.com> Signed-off-by: Paolo Bonzini --- target/i386/tcg/sysemu/svm_helper.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/i386/tcg/sysemu/svm_helper.c b/target/i386/tcg/sysemu/svm_helper.c index 145511d635..90a9de30f8 100644 --- a/target/i386/tcg/sysemu/svm_helper.c +++ b/target/i386/tcg/sysemu/svm_helper.c @@ -383,6 +383,9 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend) cpu_loop_exit(cs); break; case SVM_EVTINJ_TYPE_EXEPT: + if (vector == EXCP02_NMI || vector >= 31) { + cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); + } cs->exception_index = vector; env->error_code = event_inj_err; env->exception_is_int = 0; @@ -398,6 +401,9 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend) qemu_log_mask(CPU_LOG_TB_IN_ASM, "SOFT"); cpu_loop_exit(cs); break; + default: + cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); + break; } qemu_log_mask(CPU_LOG_TB_IN_ASM, " %#x %#x\n", cs->exception_index, env->error_code); -- 2.31.1