summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-12-29 19:51:10 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-25 17:25:25 -0500
commita373843d072f53ad72c510826d289a0d3b9062e4 (patch)
tree0d35c4174bc2a86fcc5fbae45d0cb16954ecdf7f
parent25aba34bbddc0080c8e12846596d07d09f186159 (diff)
gpu: nvgpu: add speculative load barrier (VM ioctls)
Data can be speculatively loaded from memory and stay in cache even when bound check fails. This can lead to unintended information disclosure via side-channel analysis. To mitigate this problem insert a speculation barrier. bug 2039126 CVE-2017-5753 Change-Id: Idf09b8d64dbdc2b0e4b504d4d7ea0197d38157d3 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1640499 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Richard Zhao <rizhao@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/mm/vm_area.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm_area.c b/drivers/gpu/nvgpu/common/mm/vm_area.c
index 5ed2626f..6781d915 100644
--- a/drivers/gpu/nvgpu/common/mm/vm_area.c
+++ b/drivers/gpu/nvgpu/common/mm/vm_area.c
@@ -22,6 +22,7 @@
22 22
23#include <nvgpu/vm.h> 23#include <nvgpu/vm.h>
24#include <nvgpu/vm_area.h> 24#include <nvgpu/vm_area.h>
25#include <nvgpu/barrier.h>
25 26
26#include "gk20a/gk20a.h" 27#include "gk20a/gk20a.h"
27#include "gk20a/mm_gk20a.h" 28#include "gk20a/mm_gk20a.h"
@@ -111,6 +112,13 @@ int nvgpu_vm_area_alloc(struct vm_gk20a *vm, u32 pages, u32 page_size,
111 if (pgsz_idx > gmmu_page_size_big) 112 if (pgsz_idx > gmmu_page_size_big)
112 return -EINVAL; 113 return -EINVAL;
113 114
115 /*
116 * pgsz_idx isn't likely to get too crazy, since it starts at 0 and
117 * increments but this ensures that we still have a definitely valid
118 * page size before proceeding.
119 */
120 nvgpu_speculation_barrier();
121
114 if (!vm->big_pages && pgsz_idx == gmmu_page_size_big) 122 if (!vm->big_pages && pgsz_idx == gmmu_page_size_big)
115 return -EINVAL; 123 return -EINVAL;
116 124