nvgpu: gpu: Add speculation barrier macro

Provide a macro for preventing CPU speculation.

bug 2039126
CVE-2017-5753

Change-Id: Ifa936c079d9f2a0231d0cf35c4d8bdd18d54b238
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1640497
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2017-12-13 16:25:46 -08:00
committed by mobile promotions
parent b46045f3fe
commit 43dbbaaad7
3 changed files with 14 additions and 0 deletions

View File

@@ -14,6 +14,9 @@ ifeq ($(VERSION),4)
ccflags-y += -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
endif
# Turn off when this is fixed upstream, if ever.
ccflags-y += -D__NVGPU_PREVENT_UNTRUSTED_SPECULATION
obj-$(CONFIG_GK20A) := nvgpu.o
nvgpu-y := \

View File

@@ -47,4 +47,13 @@
#define NV_ACCESS_ONCE(x) __NV_ACCESS_ONCE(x)
/*
* Sometimes we want to prevent speculation.
*/
#ifdef __NVGPU_PREVENT_UNTRUSTED_SPECULATION
#define nvgpu_speculation_barrier() __nvgpu_speculation_barrier()
#else
#define nvgpu_speculation_barrier()
#endif
#endif /* __NVGPU_BARRIER_H__ */

View File

@@ -32,4 +32,6 @@
#define __NV_ACCESS_ONCE(x) ACCESS_ONCE(x)
#define __nvgpu_speculation_barrier() speculation_barrier()
#endif /* __NVGPU_BARRIER_LINUX_H__ */