Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2452530imd; Fri, 2 Nov 2018 11:38:46 -0700 (PDT) X-Google-Smtp-Source: AJdET5fcvmJsY0ESXQ/4d54cgnqe2em5vNiSrgOoMKqq9624YytRYDzsJXVJ5hAhcg15ZX0RN2qi X-Received: by 2002:a63:3842:: with SMTP id h2-v6mr11646816pgn.300.1541183926357; Fri, 02 Nov 2018 11:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541183926; cv=none; d=google.com; s=arc-20160816; b=HwCbotIzavY4mX3UfE8XdjWT/yDwn07junmRg5RKS7X+7Z2na3BCVszVwvL63WyqoO fXuWU6R3+uHFKdxsVE+BqlL7j/+RAeoWRkuseGxepL5WKzi9hNaGxmmcmZtJdpvJ2iKm 0CoGXInBmer4z4ZmuAwyYwVQZqaXVkkih5QQ467CNtsyr6CqnsnSRpSBZn0SX0wmEwI6 5MRJfJziqasJf/IXbzvCGKlH7jGluWpnq1pZLuweWmg9r7ZRdmvkM9Wzk9M+MWJkwZIN Mp5P3t/moyZRCXKlLhlZbedDmdYJ9jAzISP60a4VVOpjCz5BmZJ0sJ9XqjEXtftFZ//V rLdw== 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=t/E+3RpM+B2P8zRF1GnlOAg8m7YSIb391JrgLTJ4bw8=; b=xH2t+HMDuvsL+KK1gevYepmUZ+GlT+fN5lqEJ0UG4a7m2EuIzzPHmtv40Ka1OZNu8L /PBUGfdd9OT+qT9unllfKaRdlCdgX+4dDuUzJsXPWBbJf0jeFs53XuRo9YueGEnsPxKb esbG/RH9/AFtSjnfvRqGdSOhTBKRywkX4Jb04CLx1h2JtV8nln+CT2s/AtYrSmfdByzo EDVoMK/mweO8UUEDowOFUJG07Ij81BEsVrd3J6jthHDpcEktSuxEvHcrD9tD3jYo1/Bv ruskV9+RDjIWJnU5CCf0tj2OsjegNPUVxbLIVxQRQdBlsTPcvQyagayh6kA63vWe7b2U a6Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LpVr2smK; 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 m3-v6si26854791pld.435.2018.11.02.11.38.31; Fri, 02 Nov 2018 11:38:46 -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=LpVr2smK; 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 S1728596AbeKCDpo (ORCPT + 99 others); Fri, 2 Nov 2018 23:45:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:39358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbeKCDpo (ORCPT ); Fri, 2 Nov 2018 23:45:44 -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 F34292082E; Fri, 2 Nov 2018 18:37:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541183853; bh=fmYxKUxfCMTeXrWvqyiEsDrd7UsGii8yp4TJ+fj/114=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpVr2smKE1g6tMZ8CkbekLH/4yR7XVsE8Xefns+Y93MLc24zsWtHfZLD8E+OYpRnn ustlkli3CvDvJkZyDdM6kt5qP3fprkkeVDnzO611HDhFH4HoyEg1w1lAcrJFdiX+mS 8v68ti0GNtjiGlalkVCo1zuHFCj8jlktA0TQmnEk= 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.19 09/24] vhost: Fix Spectre V1 vulnerability Date: Fri, 2 Nov 2018 19:34:42 +0100 Message-Id: <20181102182841.150614489@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182839.725385066@linuxfoundation.org> References: <20181102182839.725385066@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.19-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" @@ -1397,6 +1398,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);