]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
drm/bufs: Fix Spectre v1 vulnerability
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 16 Oct 2018 09:55:49 +0000 (11:55 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 24 Apr 2019 08:09:09 +0000 (10:09 +0200)
commit692898803a8b25ebaef16226933a837b7b662942
treee052fe8386f6a589ec0fc90dec2044abcda176d2
parent5f654aac63d4bcca64e1b35c206111f8153f2834
drm/bufs: Fix Spectre v1 vulnerability

idx 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:

drivers/gpu/drm/drm_bufs.c:1420 drm_legacy_freebufs() warn: potential
spectre issue 'dma->buflist' [r] (local cap)

Fix this by sanitizing idx before using it to index dma->buflist

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 <gustavo@embeddedor.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181016095549.GA23586@embeddedor.com
CVE-2017-5753

(cherry picked from commit a37805098900a6e73a55b3a43b7d3bcd987bb3f4)
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/gpu/drm/drm_bufs.c