From patchwork Wed Oct 19 08:24:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332769wrs; Wed, 19 Oct 2022 06:39:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Jrho57Dh/3dWBfyx7rEyHh7OcZJRaezxnGEIZXFMpU8fb2tOQ7ssNU160zipwbf/IVxuh X-Received: by 2002:a63:5422:0:b0:466:41b5:77d4 with SMTP id i34-20020a635422000000b0046641b577d4mr7063196pgb.547.1666186773361; Wed, 19 Oct 2022 06:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186773; cv=none; d=google.com; s=arc-20160816; b=pydH7fDbzHPLPIMV6bi2daJO3pT75LvndV1qkZwXsWtBsLfHvpc0vnUnL8mHsQrnhC 8piZs5rw3cdAadUdGzhwDc6fdWIW+7xxexVRpPM0DZYhzXxkl/U6tx1L4U4KGfIznr1Q HOB5mG/rlNpE3GEGcd2KHgwjB8+F8EoEfre/BpNO/xHHz0cdEVI/3EeBp+cVkLConu1I ZOuxWBSC6LqHtJf8aur0ng1vjmuSWlld9V1jBOpEhhvZ6mLY/tp4ehMgz9FiMPqCvjmp 9jyrB9CxTgG4qcZr33AYPz+pWMzEFTPVcy0t1rtk9kLGuofHD48o/w58gG6vVxucOMhZ cQLA== 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=MqyRt43fNIjRKJDtWXEGoaKCkypQH2fwb6rgZcmDxU4=; b=HV379tSR8emEhv1LzrXu2xuSC+z2YqsJBttq+nWeB0Ckp1QmO2HkjYulTDyCIIlK53 y5CMIK3WZL6DbSAJP6T9Git0uM6ojsZ5SMGCbL9KfVWERU3bozEMUHEkNapXOmkiQb3f +D+W3WHn4KIpu9ryf9FZoFwJ/oSykE6/GmyXRejD91lrkQejyrIu2cUaPYA9re4IEo7A 8P+81bBwLK3uejpVgVCYsKFYatmF92PH7KDLI0iX/WatE1oThAy0jtKxQp3wlfOyAXaM u6ko/E+aCCh7TBWeN5FqFxsTLfI8BOtKnNiZLOjRg2ZSP7vMrMA9fr08VHK6R4CdeeVd 5Ecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b5bOoN65; 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 q13-20020a170902f34d00b0017df3f07519si15298292ple.302.2022.10.19.06.39.20; Wed, 19 Oct 2022 06:39:33 -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=b5bOoN65; 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 S231908AbiJSNgB (ORCPT + 99 others); Wed, 19 Oct 2022 09:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232113AbiJSNfq (ORCPT ); Wed, 19 Oct 2022 09:35:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA041F619; Wed, 19 Oct 2022 06:24:33 -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 2AF7D61808; Wed, 19 Oct 2022 08:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BFF4C433C1; Wed, 19 Oct 2022 08:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169148; bh=kShm1VKzyV4zkO60J6TzmRyIkoL3AYaMOqe7iH9vzlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5bOoN65EXOMlAnsmoOs4hGHaNj7qw/M3BywnjYICA0bHyWjVZu7lIgvvuf6iP7ea rbBfsr1PI4GilvInxqJCXpGb4Eng09LUAaBwC2H5e4qOLEwfiD9siRIpQwoJdYt535 6QwU7KSGqAhEb8obk8bUdjeWpitlJeluvyZYlvdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Luczaj , Sean Christopherson Subject: [PATCH 6.0 174/862] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Wed, 19 Oct 2022 10:24:21 +0200 Message-Id: <20221019083257.641225387@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747123461887166743?= X-GMAIL-MSGID: =?utf-8?q?1747123461887166743?= 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 @@ -1953,7 +1953,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);