OSDN Git Service

drivers/misc/sgi-gru: fix Spectre v1 vulnerability
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 16 Oct 2018 10:59:44 +0000 (12:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Nov 2018 17:13:19 +0000 (09:13 -0800)
commitfee05f455ceb5c670cbe48e2f9454ebc4a388554
tree353a3e2f20bbaec5b30c29f300228315c80da55e
parente670de54c813b5bc3672dd1c67871dc60e9206f4
drivers/misc/sgi-gru: fix Spectre v1 vulnerability

req.gid can be 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:

vers/misc/sgi-gru/grukdump.c:200 gru_dump_chiplet_request() warn:
potential spectre issue 'gru_base' [w]

Fix this by sanitizing req.gid before calling macro GID_TO_GRU, which
uses it to index gru_base.

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

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/sgi-gru/grukdump.c