From patchwork Mon Oct 24 11:27:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622912wru; Mon, 24 Oct 2022 12:46:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6s+I1ktmFWx7euD+UtwJu0e5xmS0k+20s2BzB0tHdxVIOj81K+Tyz7iJPEOy5xwmdfD7J2 X-Received: by 2002:a63:4e5a:0:b0:438:9513:da55 with SMTP id o26-20020a634e5a000000b004389513da55mr28803468pgl.381.1666640815756; Mon, 24 Oct 2022 12:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640815; cv=none; d=google.com; s=arc-20160816; b=YpixTMA29tFrI2PC+1GRcikDgqkLq55CEqUC40UhHMQ2IggOAIQzPlO8t72gxkXWhw jHyd7ImNNdu968EY1fw67iZOr9KUppeavxl2s2+wk/Zx23YX7ith2KIzlevIijK5mdsl 3epkWb5Kxep/4cql86lYog7mh9zuhhv33EENbXS2ZaQaZwG8SBfXQ2q8L6guetNJFDMy PzLHme24WCEMWERU4sFtoX/A9P49Rulczl+2QkFrU9Dp1FBQPSVYCh0AExgJigHhVPQN xx+i8D0RtPu0mN+w3l0Dc65QQDpsWTSDrCN57m0as5vS3Og7vcMT/zq/KDTT9Tri5+q7 Askw== 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=ttRJvYmPbJ3Xihoo0Q/i+5tZqbfCT55Nv3feezMNBQY=; b=RXx/+TSPH5Hmv1yYqSohvSdfw9wY7GVS19HfsOv5sG4ub4VGszZX0xuV7olKBZJRIJ NzWqhqYqZGgs3tV890OQpgmEBhufG3vHAzvvPba5Lsr+84dZw1zIs+G1Vd4DfnxGcEzF aZK/8nLZ41ABTyM0gy1AhasSDBg0tgl2BSvAF5ukH0C7D+MpfwCFeNr3UHj4Ab4boo7i 3VgebBsmrv5ZCDClQKyn85IlqhFTKz4fqxsu4rX1rFiXTVcMr2EZps1nFvfQoZ7cbhE6 +15mSeNKQvMPBfenBJevH/Oo1gni1hH8gB3YH2ZnFXZwL0gdxElSxk/UHn8KbKqCtDZb SZIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="A/JJv4fk"; 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 jb15-20020a170903258f00b00186b3cb49basi385348plb.202.2022.10.24.12.46.40; Mon, 24 Oct 2022 12:46:55 -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="A/JJv4fk"; 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 S231869AbiJXTom (ORCPT + 99 others); Mon, 24 Oct 2022 15:44:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233391AbiJXTmH (ORCPT ); Mon, 24 Oct 2022 15:42:07 -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 C1E2054667; Mon, 24 Oct 2022 11:11: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 66E62B818DC; Mon, 24 Oct 2022 12:38:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C23D4C433D6; Mon, 24 Oct 2022 12:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615104; bh=HsMFPIwkFv9m4b7oG67er/E8bNyKNEePSQDI4nqw/QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/JJv4fk9gFC/lmZPtEQA+y7VF6twAZ+8v3IzU8cZ8/HaJa8lxNYc5TEc53V0Zvnh stqOlJnLA4bzebxmUUq7Seem4u9PjuFXPfPTKLmxoqpbA1lU6AIDJu/ENOtOY0RkXQ jIAzqNjI8xjKIXO87X13w+hC+IBKB4O4Xti4V22U= 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.15 123/530] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:27:47 +0200 Message-Id: <20221024113050.624835954@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747599559932153457?= X-GMAIL-MSGID: =?utf-8?q?1747599559932153457?= 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 @@ -1936,7 +1936,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);