]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commit
asm-generic/barrier: add generic nospec helpers
authorDavid Gilhooley <dgilhooley@nvidia.com>
Thu, 11 Jan 2018 23:10:32 +0000 (15:10 -0800)
committermobile promotions <svcmobile_promotions@nvidia.com>
Mon, 29 Jan 2018 16:17:44 +0000 (08:17 -0800)
commitc8126a030e8f22d72851d26a9421bd94ff9a2b7d
tree1578387bdcffeef1e09459e76e37fa24438f3ca0
parenta5e6b1912f95f6f04b16fbd86a52944f27d523a1
asm-generic/barrier: add generic nospec helpers

Under speculation, CPUs may mis-predict branches in bounds checks. Thus,
memory accesses under a bounds check may be speculated even if the
bounds check fails, providing a primitive for building a side channel.

This patch adds helpers which can be used to inhibit the use of
out-of-bounds pointers under speculation.

A generic implementation is provided for compatibility, but does not
guarantee safety under speculation. Architectures are expected to
override these helpers as necessary.

Bug 2031795

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: Daniel Willams <dan.j.williams@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Change-Id: Iee42a603b32b78c9d8ac26cef57d6eefd6e1092e
Signed-off-by: David Gilhooley <dgilhooley@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1646578
Reviewed-by: James Huang <jamehuang@nvidia.com>
Tested-by: James Huang <jamehuang@nvidia.com>
Reviewed-by: Hayden Du <haydend@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
include/asm-generic/barrier.h