linux/arch/x86
Dan Williams 98ce99aa23 x86/uaccess: Use __uaccess_begin_nospec() and uaccess_try_nospec
commit 304ec1b050 upstream.

Quoting Linus:

    I do think that it would be a good idea to very expressly document
    the fact that it's not that the user access itself is unsafe. I do
    agree that things like "get_user()" want to be protected, but not
    because of any direct bugs or problems with get_user() and friends,
    but simply because get_user() is an excellent source of a pointer
    that is obviously controlled from a potentially attacking user
    space. So it's a prime candidate for then finding _subsequent_
    accesses that can then be used to perturb the cache.

__uaccess_begin_nospec() covers __get_user() and copy_from_iter() where the
limit check is far away from the user pointer de-reference. In those cases
a barrier_nospec() prevents speculation with a potential pointer to
privileged memory. uaccess_try_nospec covers get_user_try.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Suggested-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arch@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Cc: kernel-hardening@lists.openwall.com
Cc: gregkh@linuxfoundation.org
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: alan@linux.intel.com
Link: https://lkml.kernel.org/r/151727416953.33451.10508284228526170604.stgit@dwillia2-desk3.amr.corp.intel.com
[bwh: Backported to 3.16:
 - Convert several more functions to use __uaccess_begin_nospec(), that
   are just wrappers in mainline
 - There's no 'case 8' in __copy_to_user_inatomic()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-03-19 18:59:17 +00:00
..
boot KPTI: Rename to PAGE_TABLE_ISOLATION 2018-01-09 00:35:20 +00:00
configs USB: remove CONFIG_USB_DEBUG from defconfig files 2014-05-28 09:40:45 -07:00
crypto x86/retpoline/crypto: Convert crypto assembler indirect jumps 2018-03-19 18:59:07 +00:00
ia32 x86/syscall: Sanitize syscall table de-references under speculation 2018-03-19 18:59:13 +00:00
include x86/uaccess: Use __uaccess_begin_nospec() and uaccess_try_nospec 2018-03-19 18:59:17 +00:00
kernel x86/spectre: Fix an error message 2018-03-19 18:59:15 +00:00
kvm x86/kvm: Update spectre-v1 mitigation 2018-03-19 18:59:14 +00:00
lguest asmlinkage, x86: Add explicit __visible to arch/x86/* 2014-05-05 16:07:44 -07:00
lib x86/uaccess: Use __uaccess_begin_nospec() and uaccess_try_nospec 2018-03-19 18:59:17 +00:00
math-emu x86/ldt: Further fix FPU emulation 2015-09-03 13:29:55 +01:00
mm kaiser: Set _PAGE_NX only if supported 2018-02-13 18:42:35 +00:00
net x86: bpf_jit: fix compilation of large bpf programs 2015-06-03 14:30:07 +01:00
oprofile x86/oprofile/ppro: Do not use __this_cpu*() in preemptible context 2018-01-01 20:52:06 +00:00
pci x86/PCI: Make broadcom_postcore_init() check acpi_disabled 2018-03-03 15:51:45 +00:00
platform x86/platform/uv: Include clocksource.h for clocksource_touch_watchdog() 2018-02-13 18:42:35 +00:00
power x86/power/64: Fix kernel text mapping corruption during image restoration 2016-08-22 22:38:25 +01:00
realmode x86/build: Supress realmode.bin is up to date message 2014-04-16 15:17:24 +02:00
syscalls x86/syscalls/64: Add compat_sys_keyctl for 32-bit userspace 2016-11-20 01:17:03 +00:00
tools x86, build: replace Perl script with Shell script 2015-02-04 10:58:18 +00:00
um um: Fix PTRACE_POKEUSER on x86_64 2017-08-26 02:14:45 +01:00
vdso x86/vdso: Remove pvclock fixmap machinery 2018-02-13 18:42:35 +00:00
video x86: Use vga_default_device() when determining whether an fb is primary 2012-04-24 09:50:17 +01:00
xen x86/mm: Enable CR4.PCIDE on supported systems 2018-01-09 00:35:12 +00:00
.gitignore x86/kprobes: Add arch/x86/tools/insn_sanity to .gitignore 2012-01-16 08:21:59 +01:00
Kbuild x86, realmode: realmode.bin infrastructure 2012-05-08 11:41:48 -07:00
Kconfig x86/retpoline: Add initial retpoline support 2018-03-19 18:59:06 +00:00
Kconfig.cpu Merge branch 'x86-nuke-platforms-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-04-02 13:15:58 -07:00
Kconfig.debug x86/efi: Dump the EFI page table 2014-03-04 16:17:17 +00:00
Makefile x86/retpoline: Remove compile time warning 2018-03-19 18:59:08 +00:00
Makefile.um um: fix linker script generation 2012-04-09 13:59:00 -04:00
Makefile_32.cpu x86, 386 removal: Remove CONFIG_M386 from Kconfig 2012-11-29 13:23:01 -08:00