Received: by 10.223.185.116 with SMTP id b49csp6377923wrg; Wed, 28 Feb 2018 08:25:39 -0800 (PST) X-Google-Smtp-Source: AH8x2254Le+dmVWje90GjNJt0fO3ZStoISppfI5saocsbMWy1cjV4U/6ARtpO+DjZHwyWGqweVxh X-Received: by 10.98.223.93 with SMTP id u90mr18290029pfg.13.1519835139287; Wed, 28 Feb 2018 08:25:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835139; cv=none; d=google.com; s=arc-20160816; b=dqhUyxuWWnUgluIYWAoxElby1qWHuq7DNe2M70RsRvw78CqHh3N6N6bNt+l6G3FpFt bsUjc7cmRUt2rFx5xqdQSjWzdeGHlXr0sdsULjwn8T3yyZQBhYrw/RZObBhT8/pYa5Y6 Tlzg2ffI23Ah+vR9zxMfJfFFj1zR35muFIm8WNwdGRyOUh6+Xb7b379ztQhiZ8QOPT93 /721tnoVmjdM4Xz+0fdK0lfxXhrUklGcYLe2B6sPnqXFi5VchMp3s/3FviRd8E4Qo43c tic/xHg3y3qT2uCFY3JI/QlYxMa+HlPsxlgeqskZuhfpDADAvz8EQ5pevZAG4lzWmA+u WNTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=TAktqIkCtoBJk+3LKfanRen4QHsxylU/sbwuEzKroz4=; b=GrGgy3HmHshFgZAqYaag+5QcJG4NqKnDsxB9H78lS4hEqjjGDUzSNVojMRKJ1ZxTVn E1iWX0k3N+TjIOq/Kc4xlGvsiOM071EMCsy6gaRCU/sLyAnUJZY+WCS4xj0MB5thmNcB qbEBvPc/clH4TM99EYEz84NJ7lM4gXed58Pl4/4uhL/2LG0+Ql8R3n7kE1GtLJFqN0U/ RAohHw4wY4wa1vfe4RW8yK/mKb8+OdI2sKSS2Y/7et263Ly743F87Y4b/oX5kJsHU8N7 QmCa9YtQH5Qd3MfgXHHcrvbAJQBYXjJT/SfzbYUavTD3HubGDEt9Z6UrwW/jz4Z+uYSh At3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y86si1395454pfi.19.2018.02.28.08.25.24; Wed, 28 Feb 2018 08:25:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935213AbeB1QUs (ORCPT + 99 others); Wed, 28 Feb 2018 11:20:48 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35382 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935188AbeB1QUp (ORCPT ); Wed, 28 Feb 2018 11:20:45 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yv-0006Xf-FV; Wed, 28 Feb 2018 15:22:33 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yc-0008Lq-Q2; Wed, 28 Feb 2018 15:22:14 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?=" , "Konrad Rzeszutek Wilk" , "Liran Alon" , "Nikita Leshenko" , "Wanpeng Li" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 004/254] KVM: x86: emulator: Return to user-mode on L1 CPL=0 emulation failure In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Liran Alon commit 1f4dcb3b213235e642088709a1c54964d23365e9 upstream. On this case, handle_emulation_failure() fills kvm_run with internal-error information which it expects to be delivered to user-mode for further processing. However, the code reports a wrong return-value which makes KVM to never return to user-mode on this scenario. Fixes: 6d77dbfc88e3 ("KVM: inject #UD if instruction emulation fails and exit to userspace") Signed-off-by: Liran Alon Reviewed-by: Nikita Leshenko Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Wanpeng Li Signed-off-by: Radim Krčmář Signed-off-by: Ben Hutchings --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5009,7 +5009,7 @@ static int handle_emulation_failure(stru vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; vcpu->run->internal.ndata = 0; - r = EMULATE_FAIL; + r = EMULATE_USER_EXIT; } kvm_queue_exception(vcpu, UD_VECTOR);