From patchwork Mon Oct 24 11:27:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478608wru; Mon, 24 Oct 2022 07:17:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bAJurri8Z2EmsJJEpGGRmAfn0n+uMpg28tCIkKP8J6pyAaSi7XnSbiwqde8mmN7ldEX/z X-Received: by 2002:aa7:cb87:0:b0:43b:e650:6036 with SMTP id r7-20020aa7cb87000000b0043be6506036mr31537428edt.350.1666621058628; Mon, 24 Oct 2022 07:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621058; cv=none; d=google.com; s=arc-20160816; b=nBLbKb20TQtKdCoxBoBTCJhUevGehgJn+ZFQbJPM0ZOrG1211qYc8U4su+A25rfTFw 7JouMXy7SMrnLImArnro9GO0DvqUSHAjZDwu1uNCv0zXimgFqV8Ejs7cq5mhebw1fRz0 6GmGlb3riOK3PyLc+cbE8quctZPaM9sIu8rF0M2/YA83338txKzfptLeXsQx9t5gYx2C olZy4Qd2qz/qLAx48h5v7R288GnXWJnrgE6TxE+s3fJJvL2oEiy/lILgUymIt4pUh1OH M2wNM0ifwZSbUVoTkR7Qkn8NFQ25GtJDseTuJM5NXvCFRc4X1sLAXkeL9RKVE8hiTYdn iABQ== 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=D8zlEWEDdmNAdxIkH1Bh0nK4p5rnnuxWCw/oFGKwAN0=; b=DpEl9tZbl/sOwFp/PTrs6C6V6CFePFOhwUVP6Z9LZ5vZnVR5zG0k/4R9HQfeWxTmeg HB/fwMUWB7Lk3l244iLY08BBpDmqd+D5aTHp7aBZzQIkfue6YyAju15oyd3D7+eQt/d8 dEQdGjHqu0MrQRyfMSju94lRVCwcBHuzLdt6AwEwKC8Qb2Xxh8pV5pN2gx72JwlMwhVY vQr2Xtkhn6VJCD5S8b14/ut4jhNlfZFfnyeSAOYs+iYxb3bpKC97Uew7RrcOvdxYEQEv LPY8lP4RVDNSDtYCd6EHw0fpvsGada+V5LIRbtTjx3knt/e7nyzIx126CPa0u7RfbyNN ucDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v0UWxV8C; 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 qa43-20020a17090786ab00b00782ece08669si28777090ejc.13.2022.10.24.07.17.13; Mon, 24 Oct 2022 07:17:38 -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=v0UWxV8C; 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 S236631AbiJXN5t (ORCPT + 99 others); Mon, 24 Oct 2022 09:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233393AbiJXN52 (ORCPT ); Mon, 24 Oct 2022 09:57:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F9E754181; Mon, 24 Oct 2022 05:45:02 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 77339612A4; Mon, 24 Oct 2022 12:20:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84A3CC433C1; Mon, 24 Oct 2022 12:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614013; bh=AEDN9xuNlbHo/e5IAl0M+CHnwhGvTQQAttrpcw65NuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v0UWxV8Cx6I5E2mMOj1nPEBHZS69QDf14bAs0kiDv9BtP3o95wDNRI6EKpTOlQ/uV qwXRzY34eyiN7ZEQdNBRRc+wNN4i3TDma6c9aHRRh/9ec9jJVHcKxt1J3k9GvrTp4Q hIDWmuHEAC+4RqNfXH8HFu5JqLWUXPp1x/kJIlsU= 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.10 082/390] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:27:59 +0200 Message-Id: <20221024113026.102951946@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747578843466900874?= X-GMAIL-MSGID: =?utf-8?q?1747578843466900874?= 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 @@ -2039,7 +2039,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);