Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3523043imu; Mon, 7 Jan 2019 05:03:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Wz5paoJC6bgRQC6b/+Bjq3pAMiS1AjeZ72tnMYGHkxbU0hChWpfEnpD00pSw3JiNQwrv2 X-Received: by 2002:a17:902:2b84:: with SMTP id l4mr61346760plb.191.1546866233086; Mon, 07 Jan 2019 05:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546866233; cv=none; d=google.com; s=arc-20160816; b=FKbLdDfgwNQDm+XUKfhvJlmEMSNqmJtvcUVTsMxSYBRKZwZVsIJbLBH9B9m78XxkxH pp7zcVirs0UzpqmA31DONJleAYSLL4Sa7fbB7ofzZMi9s5rv5ez2mhBVwRpIiRA/whhY TwK5q6pgiR6psb0QQtSsD6TmDUGxN1BOCQIVaC3TjUCvEVGNYGnmqcC8d9AQoyH9vJDN EmYBtBnvzwFc86O9aPzJrY0kyrOPcEREwTGehYXKiGKKU+gT87XVH5LwSqyEkT1PMG2p XC4xPqloLfsTxpSZlBvdHSg+U/aogwuzwoI34N4O24FBKO5uTXW5M8QrSLwfocIKcRsV oSZg== 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=7MCXojmXgJEbUQEsur+MZyRXwdF1OxUpbwNl9lVXs/Q=; b=Y3lldKH5D1KgTUoyYCAbWIbWdndchm7qIZ53i+/VPG/U7D2FfCdGZKJCDYmeG9Sp7R /1rmDVYtXt2+q6BY2BgivCLgbFC/C7cMiNKoDr1rFUhvAP7IRkS+B+26TFk61n7XqxOx /u9w9jDn4TU2fmuZ8REXVo4kSX7bV5voGQfHJR/dZAgsYPaNpReZVldCaR95EmyUPq2/ TzL0qfQORgHvNXUXwJ7+IvDkg0FlAgMPcImJZJDxfZLppXoLGrfsDEcEI7cw6bPWCj5S r182NUF0ldHbMTlZ0MAJKdoPAuCy0Nd8O4Xh8WdJqp3HlrJNLGfaukCS99BdJBenc7xF LPQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mS+D8htU; 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 x64si64117533pfb.120.2019.01.07.05.03.37; Mon, 07 Jan 2019 05:03:53 -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=mS+D8htU; 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 S1730667AbfAGNBr (ORCPT + 99 others); Mon, 7 Jan 2019 08:01:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:49194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729655AbfAGNBp (ORCPT ); Mon, 7 Jan 2019 08:01:45 -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 80A30206BB; Mon, 7 Jan 2019 13:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866105; bh=Rv2hE2zlNol/70MxCs8l6bbvNaBl7U7go5/3M7s/eTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mS+D8htU0rwMnapj9ehBfQSphcZy4w0wwH6GqDXOSWI8OPcF47frfZ0SMAQ6riqgk 4qPoWKzf2wMVK4p1dcexR2nSrCVUsq12TekmMVQA75qBeftT+AdGHiWOefANs81srG W0btd9Sl5+qEiaNUhOclu4aQqC3rrmOhcfbAh2pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Takashi Iwai Subject: [PATCH 4.14 040/101] ALSA: pcm: Fix potential Spectre v1 vulnerability Date: Mon, 7 Jan 2019 13:32:28 +0100 Message-Id: <20190107105335.100613782@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@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: Gustavo A. R. Silva commit 94ffb030b6d31ec840bb811be455dd2e26a4f43e upstream. stream is indirectly controlled by user-space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability. This issue was detected with the help of Smatch: sound/core/pcm.c:140 snd_pcm_control_ioctl() warn: potential spectre issue 'pcm->streams' [r] (local cap) Fix this by sanitizing stream before using it to index pcm->streams Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1]. [1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2 Signed-off-by: Gustavo A. R. Silva Cc: stable@vger.kernel.org Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/pcm.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -129,6 +130,7 @@ static int snd_pcm_control_ioctl(struct return -EFAULT; if (stream < 0 || stream > 1) return -EINVAL; + stream = array_index_nospec(stream, 2); if (get_user(subdevice, &info->subdevice)) return -EFAULT; mutex_lock(®ister_mutex);