Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2461191imd; Fri, 2 Nov 2018 11:48:38 -0700 (PDT) X-Google-Smtp-Source: AJdET5drpR7N7k4n0ivrpi7VPOxiOV+ItYeQZo7ftteMTI7oscTYanu3DN50nHSUGF6oBR/9hY/Q X-Received: by 2002:a17:902:2:: with SMTP id 2-v6mr13027372pla.178.1541184518677; Fri, 02 Nov 2018 11:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184518; cv=none; d=google.com; s=arc-20160816; b=XL4gS70oW/ZUURXCtKpWvSDb1AYsBU2Th+U/Bhn/kKQkEbh+qV3GF5JJrNN03Er6ww f8Lm2VsWXdWdvgXF1kwkG9Mei43k4axUVXPYuuMQdwtgNEHgMuRW2JwQqKDLD3JrJcxd d+jjqPszeV15Dc+FeROCGc491w4xxT/0TaFp0NK6Z8WzOfShHfZMH7rcuF96ji8e4uNN 5MEoKr2b+J3d5KkrTkKtNQM94+mA5mgYnTJm9tHCm6NEQfhuLdhBjPuJKiG+IZtm9+Dw YFIxbt7GsQZaA+mm40Z9d+VU2RNfzxbtWJZ2GT6TkUTYAruH1VUV6mO3m6cmD3tx5OT+ 7fZA== 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=xA9/1SywF3z+586qvUvLA/f15n8/2cORpmTiqs1oaQQ=; b=v1boBA/ycbR0M8wkUUAq3/T8ixkaM/cQqdKlnTUO4Cu40fSo66sLqJiANPAP2A/aDN TKS5bD5M9QUWGBVacU1dxlaLt8xAyUrriXfdly1DUkxBxkvvWjTiUxRmMcl+3SeqooxG 4euyuT94iQSy6Ke8Qz1mJJ1KRskMZgk6AZDV2adORS2jxGZvtAAM1vxWGCZuId3BcceZ f6bJE+CUYrwYealsblMF/0D3YbSgU1DL4XFE24WkVTxvPepeqcdN7kJo1WQkkGuVOWUZ app6m5/FShJcZakwLBKdmI0f5UntrZAV/OtbARVhU00V/o4ca4S5mvgA+kpiW4UL7WJl imtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="tnQZ2b/M"; 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 w11-v6si4488297ply.404.2018.11.02.11.48.24; Fri, 02 Nov 2018 11:48:38 -0700 (PDT) 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="tnQZ2b/M"; 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 S1730333AbeKCDyX (ORCPT + 99 others); Fri, 2 Nov 2018 23:54:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:50278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729136AbeKCDyX (ORCPT ); Fri, 2 Nov 2018 23:54:23 -0400 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 60D1120837; Fri, 2 Nov 2018 18:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184370; bh=8NRCr/cpqpw2JFL6wTeXCBn3EmyvbkLyFOFXyfS5hIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnQZ2b/Mj9EcJ61tGpm227mD6LZmXbpkpaCuLZwHHbl+z11njbEeOFD2T6scMOJq1 U4UxzcEfzLrZFhXlWiEo299zl78kAkC/apJgaZotpUCFfIT/1NUSbWmk84oYFRSihJ 8iFMFmovQtc3QiRYWv/z/l0j9h7V7H4AvmOJYSbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Michael S. Tsirkin" , Josh Poimboeuf , Andrea Arcangeli , Jason Wang , "David S. Miller" Subject: [PATCH 4.18 120/150] vhost: Fix Spectre V1 vulnerability Date: Fri, 2 Nov 2018 19:34:42 +0100 Message-Id: <20181102182911.359261123@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Wang [ Upstream commit ff002269a4ee9c769dbf9365acef633ebcbd6cbe ] The idx in vhost_vring_ioctl() was controlled by userspace, hence a potential exploitation of the Spectre variant 1 vulnerability. Fixing this by sanitizing idx before using it to index d->vqs. Cc: Michael S. Tsirkin Cc: Josh Poimboeuf Cc: Andrea Arcangeli Signed-off-by: Jason Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/vhost/vhost.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "vhost.h" @@ -1362,6 +1363,7 @@ long vhost_vring_ioctl(struct vhost_dev if (idx >= d->nvqs) return -ENOBUFS; + idx = array_index_nospec(idx, d->nvqs); vq = d->vqs[idx]; mutex_lock(&vq->mutex);