From patchwork Sat Oct 22 07:20:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090267wrr; Sat, 22 Oct 2022 00:46:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6feF7K5pBxzzKIAMvzuvxdcxdjbxCRSjYJH3ylwVRUQyuMukzWtKy2b0ou9KgemHFrBMaB X-Received: by 2002:a63:2402:0:b0:460:99af:331c with SMTP id k2-20020a632402000000b0046099af331cmr19027263pgk.460.1666424779920; Sat, 22 Oct 2022 00:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424779; cv=none; d=google.com; s=arc-20160816; b=DUu/v2bpmuEFuISjLY/VTZBrqfv3mxQTVoovRc4QQ2S0fEFg8/ab1PDqhF5SqIgRgy usbC6vPu7MDcL2rVK/2YwwW+C1TyYNimHDpWdtF9aVqlsasigp8IFlzf6KXWB6SXPVL6 EWmSZy4nFZ9S1Tr5dGcCtgrFYES8rOUKM+/8C1LfC7BriYeymkK0h66DEDLWTmlpvsyy qV18y4rFn2xVIsvijYFD8neCuhIXHGRD3oZT6hmTUU7DHNBzaQFZfDVDQuEuMaeBSUbX 1XO1ZZD0x7oh6hGB8YRGvCwxTl3GrdwC3vYsXmIU+XtbwMYebfYMxr9EYw4DkO2Xi+nL F93Q== 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=vaE8nSSzT0ZpTCJ1JYSxB0280kcEsvv+iNtSXS1cJ3k=; b=fl4Ihb1DIaorTex6y+BvQhMn1JVDU8MDRxzHGrnXNO/HquB3LdshfzjzZtCPHQuq16 1cJLP5SNz+CZzBKZwvEB4F9byHzp8xSOC6mV50YyESlOg3cQcuipWa4ETkpZEcz9cpGO sdwuE7L9LwDmzTKG/rIag7rl8Xk0q2CI6m1Y7BIbE4gC1cBWg0t4vzTk0bxzPfos9krr N7uZjV73BUAs0dqbaFpruthyRA1ubVYnSSweJrPJE1FEYGq6OWK+ykUNUXBSAA9nDGT4 hiy2bdkznBYWdXRbvxYe0cgCcNojzXCoM0v79OSX9fci1v/Pqm2Xlzh1OJKq3dzC/Isx gh+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XZyYmiy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz1-20020a170902ef8100b00179f1584540si293675plb.564.2022.10.22.00.46.06; Sat, 22 Oct 2022 00:46:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XZyYmiy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231268AbiJVHpp (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbiJVHnd (ORCPT ); Sat, 22 Oct 2022 03:43:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A9C57884; Sat, 22 Oct 2022 00:42:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1C705B82E0A; Sat, 22 Oct 2022 07:41:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76AABC433C1; Sat, 22 Oct 2022 07:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424479; bh=06sUnyiUUf5pAI439nFvDLqDo5NANVTJ7UYdi7Hv6zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XZyYmiy6Nx3dbOYaJCgYfPvdI+dDOrGIp8eIoDY+FIKxnnfniTziJ/6dRgO81mr4C dj0vRhYPAWS2PG/tSes02tz+C4wyXRjZ5VTa+HcyJxjDJ66ASwy6wtXDN32atdP7Hb TBEz6L4w0I7t11BLarZ0V0nNW+9BIlRRM3hyQ7mU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Luczaj , Sean Christopherson Subject: [PATCH 5.19 160/717] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Sat, 22 Oct 2022 09:20:39 +0200 Message-Id: <20221022072443.800987816@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373030410712225?= X-GMAIL-MSGID: =?utf-8?q?1747373030410712225?= From: Michal Luczaj commit 6aa5c47c351b22c21205c87977c84809cd015fcf upstream. The emulator checks the wrong variable while setting the CPU interruptibility state, the target segment is embedded in the instruction opcode, not the ModR/M register. Fix the condition. Signed-off-by: Michal Luczaj Fixes: a5457e7bcf9a ("KVM: emulate: POP SS triggers a MOV SS shadow too") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20220821215900.1419215-1-mhal@rbox.co Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1955,7 +1955,7 @@ static int em_pop_sreg(struct x86_emulat if (rc != X86EMUL_CONTINUE) return rc; - if (ctxt->modrm_reg == VCPU_SREG_SS) + if (seg == VCPU_SREG_SS) ctxt->interruptibility = KVM_X86_SHADOW_INT_MOV_SS; if (ctxt->op_bytes > 2) rsp_increment(ctxt, ctxt->op_bytes - 2);