x86: split __{get,put}_user() into "guest" and "unsafe" variants
authorJan Beulich <jbeulich@suse.com>
Fri, 19 Feb 2021 16:18:27 +0000 (17:18 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 19 Feb 2021 16:18:27 +0000 (17:18 +0100)
commit6a1d72d3739e330caf728ea07d656d7bf568824b
tree09d2dd64f8ffefc180e52cb8e8afd1dd09eda007
parent6794cdd08ea8b3512c53b8f162cb3f88fef54d0d
x86: split __{get,put}_user() into "guest" and "unsafe" variants

The "guest" variants are intended to work with (potentially) fully guest
controlled addresses, while the "unsafe" variants are intended to be
used in order to access addresses not (directly) under guest control,
within Xen's part of virtual address space. (For linear page table and
descriptor table accesses the low bits of the addresses may still be
guest controlled, but this still won't allow speculation to "escape"
into unwanted areas.) Subsequently we will want them to have distinct
behavior, so as first step identify which one is which. For now, both
groups of constructs alias one another.

Double underscore prefixes are retained only on __{get,put}_guest(), to
allow still distinguishing them from their "checking" counterparts once
they also get renamed (to {get,put}_guest()).

Since for them it's almost a full re-write, move what becomes
{get,put}_unsafe_size() into the "common" uaccess.h (x86_64/*.h should
disappear at some point anyway).

In __copy_to_user() one of the two casts in each put_guest_size()
invocation gets dropped. They're not needed and did break symmetry with
__copy_from_user().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org> [shadow]
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
xen/arch/x86/mm/shadow/multi.c
xen/arch/x86/pv/emul-gate-op.c
xen/arch/x86/pv/emulate.c
xen/arch/x86/pv/iret.c
xen/arch/x86/traps.c
xen/include/asm-x86/uaccess.h
xen/include/asm-x86/x86_64/uaccess.h
xen/test/livepatch/xen_hello_world_func.c