Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp47476imu; Thu, 8 Nov 2018 14:31:45 -0800 (PST) X-Google-Smtp-Source: AJdET5crlg23D0JWFlNfvRX6FF7KNmZl1fIpnomkLRZnGq+90hq+1kya+mWsuykevcgYAuCZjV73 X-Received: by 2002:a17:902:67:: with SMTP id 94-v6mr6146998pla.225.1541716305383; Thu, 08 Nov 2018 14:31:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716305; cv=none; d=google.com; s=arc-20160816; b=Quwj6XfUkQ1RwjsRtzJy7yw/tm1FMAs1KzImarlz4oLBiAQw7MuGsY/HSwvkbGYVdk 4u6rgw81JND8v5Ys9we3bkgXaWy2ceWkM069oqn4TjjyFjGkPCqSuA+cWNoUcnVG5AE7 BHTqWkpogW2s4x8eA57Fu7yy6y5d3sxAYnVw0b2QGNbqoEHIMA4xQTHcAcT1qs/sddB4 35eDqgBfhSpLJ6nCTp+VNSlQu4O5vClfuabGxKzNua2PTj48TXElYC0wol2cvw+o7EHQ aZvaNfqm051fSq8zWJhrh1MWHkY0yebf4Ctz8AGvDxWq5+QmdgWgI8LNGRiheQQ7rUKu nZQQ== 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=b4poiU2vNZICJbSPKHFUaLkCILQu2OqwqOr6Qp6lnI0=; b=rjqFJtgEwOabEh1Ior+WWLtEjpDRiIkuuiW0oXn94LfjVsnQnI+VCd7UlqNQMIUhor u5RYhD22nWVizUfuYhr2H0QhK3JeiPofyzHFQTl9xyf6aHyuzQ0Q9OO2WQiJtGK5JPCS ybjzWs3cEJCRuRaEVLPMNpv3qTIsALG8yKdu4f262ln2Ly8oEgJcSeJ1GVruGK1vmz3W wldVJec0Nv1elEtxTASszasTz4aVOONQlh6gjIWFdFAPqYdXDFChnBdfuQLckMG7MrLg cQ797a/UPZqlZxNjEb032fvBMP1Q6+DNDmApFXvGYj1x7MqVn4Yrnl7/IQxyonfsTPsj 4Wug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZuT4BgDA; 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 j191si4924023pgc.15.2018.11.08.14.31.29; Thu, 08 Nov 2018 14:31:45 -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=ZuT4BgDA; 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 S1730706AbeKIHi2 (ORCPT + 99 others); Fri, 9 Nov 2018 02:38:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:57650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728491AbeKIHi1 (ORCPT ); Fri, 9 Nov 2018 02:38:27 -0500 Received: from localhost (unknown [208.72.13.198]) (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 08EF620989; Thu, 8 Nov 2018 22:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714459; bh=pKetddId1z3buId3afSJThTDC6IEIO20d85iVR3CPno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZuT4BgDAs+nNvOTKKKljbVqFi2LvltvQTZJ5Go7so7nK2GE4daUDy5kzRwoPtg+VU obuKcTdCpB7hPi34Bax5ao9iiFgC6VdVqIb6dV2y0kwfdZaK5vw81IRj+8eN/Caggs 5NKSyGA0YLwnZmFAhZcLriDztqzJLrHpvg8n9Ou0= 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.4 099/114] vhost: Fix Spectre V1 vulnerability Date: Thu, 8 Nov 2018 13:51:54 -0800 Message-Id: <20181108215109.654652832@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@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.4-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 @@ -27,6 +27,7 @@ #include #include #include +#include #include "vhost.h" @@ -748,6 +749,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);