Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2715199imj; Mon, 11 Feb 2019 07:24:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IZNJa/W/pMAjy7UVq0kOiCvnH9O1VHrFYGxOx0ooBLyawQdD6wQpmS9AZF/BJg9sJa37jUm X-Received: by 2002:a62:1d8f:: with SMTP id d137mr36899813pfd.11.1549898669158; Mon, 11 Feb 2019 07:24:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898669; cv=none; d=google.com; s=arc-20160816; b=ojG0Kd2Dj0QCaZCIiQ+dWAUb5nSrWi81+GzbK3IndwMtGLGacY/PWvyOkIDFl3hKaB wZj4O7FqXlnLqiwvBeLtUSNt7xEDoXVYiDkeo6qu66VZrNPejmHwd9ah8qI5NvQv25sY FgcERQPooq/uDNxZS7WII3BtZb7y9vMc3OSVV+LsIfEFNsAmaLmo/S/AJE5M8Lx0A+g7 ykNNEXYu7WEBkxksqd5sZkAgkIftu9nLYZRxHmXBR5Z9sMcfgDAOk1aNKn/XFNPtjFpT z+fj4C5Qf9JH/lkcckUn373PAdBiAijoFk8jNIopixS8IffbEHhd/2yScLRBjRoG8b1f c/OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i5W8bSSJ6obbikyTf2wncbfNk6HX3ML5om5rhB8SJhM=; b=f9kMgGcFhmYFT/vS6k6HVUWK7Yp9lEiw8NvVu2W3W/vszVBcpISm/XNRLkxp4BPYzJ ZKRpBSwv1bXzF8gVKejqjDje92BQzqMFv+K/TIbcY6KclOjsxgyQYMQ5dJld4BWxSjkQ T4tHvzJfZeKMv6ZVTwsVWoVeHweLBxg4YzfgZYGFxSKjddlNEXOqyzAnkRv5hqbxaiN8 A4zX0MK8NzchEekGbTuoOwt0WGhpo4xSYO/2pfsTCeUUdmR0vCbUhr0tmoX8hqMQwicW xbt/KPbscovUI+5e3uPKSevpZKXR6l3MJCZqlJNbc/YyfHxlu96AsDLW9gr9SpsWn8z2 f6LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bMbw0ZgV; 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 u9si9324927pgr.550.2019.02.11.07.24.13; Mon, 11 Feb 2019 07:24:29 -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; dkim=pass header.i=@kernel.org header.s=default header.b=bMbw0ZgV; 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 S2391926AbfBKPXT (ORCPT + 99 others); Mon, 11 Feb 2019 10:23:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:51904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390619AbfBKPDZ (ORCPT ); Mon, 11 Feb 2019 10:03:25 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02EF0222B4; Mon, 11 Feb 2019 15:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897404; bh=WE1lVhiA52E9KYMV6zuETERSiAfOS1RvrLR/iFhckro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMbw0ZgVj/cmc91Qawf8yWBm32+bdXEF0cdjQla45X2S1zTGiLOa1k7ZPlh/yTu3s Es9Oz6DEt1Gi2ZKYdE5BaQK9YlSF+/aIFUcET6P/RKHa9B3QRXkWXCkXMNA/1mPSVh z4inYW1Xe5SldJr1XZSdDQuwlD/uR8WAzmC1RPuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Wilhelm , stable@kernel.org, Paolo Bonzini Subject: [PATCH 4.14 192/205] KVM: x86: work around leak of uninitialized stack contents (CVE-2019-7222) Date: Mon, 11 Feb 2019 15:19:50 +0100 Message-Id: <20190211141840.968851002@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paolo Bonzini commit 353c0956a618a07ba4bbe7ad00ff29fe70e8412a upstream. Bugzilla: 1671930 Emulation of certain instructions (VMXON, VMCLEAR, VMPTRLD, VMWRITE with memory operand, INVEPT, INVVPID) can incorrectly inject a page fault when passed an operand that points to an MMIO address. The page fault will use uninitialized kernel stack memory as the CR2 and error code. The right behavior would be to abort the VM with a KVM_EXIT_INTERNAL_ERROR exit to userspace; however, it is not an easy fix, so for now just ensure that the error code and CR2 are zero. Embargoed until Feb 7th 2019. Reported-by: Felix Wilhelm Cc: stable@kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4611,6 +4611,13 @@ int kvm_read_guest_virt(struct kvm_vcpu { u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; + /* + * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED + * is returned, but our callers are not ready for that and they blindly + * call kvm_inject_page_fault. Ensure that they at least do not leak + * uninitialized kernel stack memory into cr2 and error code. + */ + memset(exception, 0, sizeof(*exception)); return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, exception); }