From patchwork Mon Oct 24 11:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554786wru; Mon, 24 Oct 2022 09:58:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Fj98JLkCBq5daLZgfSKwxnKErnARGSTQaq8MOuK9G1seI6QkaKpF7ZibLZLMaQuLKqXME X-Received: by 2002:a17:90b:4d0e:b0:1f7:ae99:4d7f with SMTP id mw14-20020a17090b4d0e00b001f7ae994d7fmr73928107pjb.200.1666630683511; Mon, 24 Oct 2022 09:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630683; cv=none; d=google.com; s=arc-20160816; b=xFEPvxRMILFCl2IGWMZt7F3JJWhihNqUF2UzcBP9XteFXzxbe3vEDbwJFUY5+JFVJX 5oZ2vTdtIarkADGB6a+1F6UE/fSQO14eF73raeTAIiVosOMm4VZZSyHeszTP1NDbj1TC yNwZA2nn7gaDU1OEwkeXa6iNe4LlCFvOLRqvrKRYpSwewihtb1Iae3PLSQNMPtBw53fI Q+A3uJcZiGYA18z0NVKXgGyg1EmNgccfBkuD2ctX5c4bxYDlF+7LihmbQ/BBOp9znPEW 3wfGg6lduxtuQO9lGQVPbMoeNCdXelA/lzsd5sPUFKFXi+bRp/fo4Ap5u/m4uJcRTAcj K0Nw== 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=3paHA/VENjwUE9u8un4N+G/GGDUMDO+3ZdjCK//tX4w=; b=yzFMeo/xWGZg/A8lbYQiO3/gST4qiMY92/BO1C7fuPgVGjw/BJ2t8Xdzn0N/+auBWv IufC+AzMzY/KdBkCmRzueCJT0Ejqh19P47gvoqiRrRhkabHj8JZEtSAnpKAHIWRncjIv qoyH/18mMLdXJG0KpyCGYIXxt1Zr0HWDuMlFoMMrhBtnNgxksddzFbkHPv/YzZu6Dpob f3UC6uWv2ML4XZrrWOkoaKt3V0osn4+rUq7w2SaxQI9JazoQ5BGEc77i5gp4qPOYuElk w7FVkuUmgbxvTHWrPgKLlhN2MuuO9xpzhoJCbQVOFCelooNIlaEf2IspEB2xHlM4q1fV 8pYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EpbIDIpJ; 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 d14-20020a17090ad3ce00b001f31f339134si8234656pjw.152.2022.10.24.09.57.47; Mon, 24 Oct 2022 09:58:03 -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=EpbIDIpJ; 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 S232333AbiJXQxk (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235374AbiJXQt3 (ORCPT ); Mon, 24 Oct 2022 12:49:29 -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 D7DDADFCA; Mon, 24 Oct 2022 08:32:44 -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 E3FC9B81189; Mon, 24 Oct 2022 12:06:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C1ABC433B5; Mon, 24 Oct 2022 12:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613216; bh=sXnZwpG+EnVCgf+pJ+E6fXXKiV+zbor2+tgZXkotU/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpbIDIpJIUN3mIo4uwzwZpBiquC/qTYwrjgpfEnpriN6h9hVX/w1aKLdbRQi6+Sgt OtijxfePiovuXHdSUzBv0v3rwyAJaPdmMHoPdTZHCzL8YppJBFsV0Tv4bT19Nw+WNv LdZ0Pec9Km/fCnqgtxeOy1Dtc48eX6/wJ1r6VUhw= 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.4 052/255] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024113004.154878047@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747588935318587854?= X-GMAIL-MSGID: =?utf-8?q?1747588935318587854?= 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 @@ -2020,7 +2020,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);