]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
x86/uaccess: Use __uaccess_begin_nospec() and uaccess_try_nospec
authorDan Williams <dan.j.williams@intel.com>
Tue, 30 Jan 2018 01:02:49 +0000 (17:02 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 8 Feb 2018 03:08:35 +0000 (21:08 -0600)
commit89a96ff800f0276ea4804074595e75fad9b7bfd6
tree7021ee8eb43bfb6477076b06134608a7b3877cd6
parentc335e9ac170072476e90fdc510b7b6fe3dc6f26b
x86/uaccess: Use __uaccess_begin_nospec() and uaccess_try_nospec

BugLink: http://bugs.launchpad.net/bugs/1748072
commit 304ec1b050310548db33063e567123fae8fd0301

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/x86/include/asm/uaccess.h
arch/x86/include/asm/uaccess_32.h
arch/x86/include/asm/uaccess_64.h
arch/x86/lib/usercopy_32.c