]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
IB/hfi1: Fix Spectre v1 vulnerability
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 31 Jul 2019 17:54:28 +0000 (12:54 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Aug 2019 17:05:26 +0000 (19:05 +0200)
commit683dbbec107970c93d64e367ac93ee31e19e8081
treea9db5b7f885f918ca8cb51201dabacc2fe435ca2
parent2a14a26ee583f4370fdbf973613d1ff8f971d744
IB/hfi1: Fix Spectre v1 vulnerability

commit 6497d0a9c53df6e98b25e2b79f2295d7caa47b6e upstream.

sl is controlled by user-space, hence leading to a potential
exploitation of the Spectre variant 1 vulnerability.

Fix this by sanitizing sl before using it to index ibp->sl_to_sc.

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://lore.kernel.org/lkml/20180423164740.GY17484@dhcp22.suse.cz/

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20190731175428.GA16736@embeddedor
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/hfi1/verbs.c