From nobody Sun Feb 8 16:33:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1627204209; cv=none; d=zohomail.com; s=zohoarc; b=c1q6xbIQTy7c6qyeDU0BNlWxVFIycQjN+/5PCxN3vRfxf3+xiurOp3hIJo2lD2qy4NSzrj0BTMfOnvg1fACZw6IGyGlZQTri7E6JSkU7ju1iqW84AXznTPV28pF+LQpFM3X0OixKi82uTGGBUr+6YzKD6zJmHGI0hPDC4Z/cRXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1627204209; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=EkwdUKgj2Mz1ZLZ2MNRhZ9UMM4ZSQ09/Bhoi9EtkSUE=; b=dOX9xiFrIMHf4G3toUalzgeUbNdPD12Gr2IAumcs9CuSYIVqjfZ3e5+n5lhUF3NCluuVsyeQWoXaoTC3Y91qcaxvYjT33BR1Vmsuco+EGr4VwN7P13iCOuWGAvTN3xZxGJ1BHiCFrtjYORwU7iI4MKidQnTra4lfy2JLhzqnHb0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162720420936291.05716925089166; Sun, 25 Jul 2021 02:10:09 -0700 (PDT) Received: from localhost ([::1]:42640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7a99-0005ZD-M6 for importer@patchew.org; Sun, 25 Jul 2021 05:10:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7a89-0004ob-Lj for qemu-devel@nongnu.org; Sun, 25 Jul 2021 05:09:05 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:43571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7a88-0000UK-3O for qemu-devel@nongnu.org; Sun, 25 Jul 2021 05:09:05 -0400 Received: by mail-ej1-x635.google.com with SMTP id ga41so10412597ejc.10 for ; Sun, 25 Jul 2021 02:09:03 -0700 (PDT) Received: from localhost.localdomain (93-33-124-87.ip44.fastwebnet.it. [93.33.124.87]) by smtp.gmail.com with ESMTPSA id bd24sm3136929edb.56.2021.07.25.02.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jul 2021 02:09:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EkwdUKgj2Mz1ZLZ2MNRhZ9UMM4ZSQ09/Bhoi9EtkSUE=; b=TiOoZXoxXVpEddoX7Svk6Cd7BJ4G9o9bChKGNs7VBMAhB4JkoPOkih1nTIJ0GFQMd9 AmZr7iNnr0/hHVtlxY3uNt0LX2pL/hKmWDnCPxk+lRENJLa4YlcRLfTS8lQWsZk4UAby iDdMrTzQYfQqHkgvfsWJNFosZnd4aVgklB54ozchfHc//QGL3HlkSqOIo54p+szkEqF5 ffNjY0zcvxLlXY5LvAsa7i7X1NjK+9QYfKMrQ4aJxUfCMww2zYCFAbTBVeIy5sSiUopb nJPGaoZKz4IhCDyBQmLHnNlWr4yhBeWy3ve5gj7+0Cq/3miDfzQjCLdgCR/n0L9wPZBs OvHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EkwdUKgj2Mz1ZLZ2MNRhZ9UMM4ZSQ09/Bhoi9EtkSUE=; b=FpnlmF2J2xnUGQz+f++mUqfddA5M9OLANYbxhczDvrsyE5jPulOfwFOZIx0Ffh3Ky7 e8pnT6KcXY+0kdQiyGOA4uQLI2yTGq1FrQoeswS/BTV63DAjNuSktVMSEax6+1IDE+bh frrd+kt/aENfjY0gTZdKmdoP4usNb8xk3txLfqzznogmy8mI2Eioa36/9ruzugqxi4Ds B1/PQwMmMAgbsL50MLSOmUMC+v7j7vJQ6G6n3wGFYbmxEkReIDP44sjT1vv6mpla+6jG tA8vcypyt1DbmepiT/Qyqbz2wkXN4BSgauk9kTaiDy9vSfNFXUa2e2mJrNDWcuVmQiQT z2ug== X-Gm-Message-State: AOAM532E0PynLHgtfsQCDcjCVCXowPzO5cQvm34baJ56xhtyLC5UPYPA gjuo+64D/ajZTUWX5VYL1EQmLZ1hmN4HBQ== X-Google-Smtp-Source: ABdhPJyRRO5uwDawoiopHJroebq6U0qogsPjSHtiP1HMbvv0Uh518oao/PYCBlnh28gQtsdPhimP5A== X-Received: by 2002:a17:906:fb12:: with SMTP id lz18mr12641086ejb.324.1627204141958; Sun, 25 Jul 2021 02:09:01 -0700 (PDT) From: Lara Lazier To: qemu-devel@nongnu.org Subject: [PATCH] target/i386: Added consistency checks for event injection Date: Sun, 25 Jul 2021 11:08:55 +0200 Message-Id: <20210725090855.19713-1-laramglazier@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=laramglazier@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1627204211304100001 Content-Type: text/plain; charset="utf-8" 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 --- 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/s= vm_helper.c index a61aa23017..70d5c2e35d 100644 --- a/target/i386/tcg/sysemu/svm_helper.c +++ b/target/i386/tcg/sysemu/svm_helper.c @@ -395,6 +395,9 @@ void helper_vmrun(CPUX86State *env, int aflag, int next= _eip_addend) cpu_loop_exit(cs); break; case SVM_EVTINJ_TYPE_EXEPT: + if (vector =3D=3D EXCP02_NMI || vector >=3D 31) { + cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); + } cs->exception_index =3D vector; env->error_code =3D event_inj_err; env->exception_is_int =3D 0; @@ -410,6 +413,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); --=20 2.25.1