zephyr/kernel
Andrew Boie 09dc929d41 userspace: fix copy from user locking
We don't actually need spinlocks here.

For user_copy(), we are checking that the pointer/size passed in
from user mode represents an area that the thread can read or
write to. Then we do a memcpy into the kernel-side buffer,
which is used from then on. It's OK if another thread scribbles
on the buffer contents during the copy, as we have not yet
begun any examination of its contents yet.

For the z_user_string*_copy() functions, it's also possible
that another thread could scribble on the string contents,
but we do no analysis of the string other than to establish
a length. We just need to ensure that when these functions
exit, the copied string is NULL terminated.

For SMP, the spinlocks are removed as they will not prevent a
thread running on another CPU from changing the buffer/string
contents, we just need to safely deal with that possibility.

For UP, the locks do prevent another thread from stepping
in, but it's better to just safely deal with it rather than
affect the interrupt latency of the system.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-18 17:13:08 -04:00
..
include arch: all: Remove not used struct _caller_saved 2019-04-18 12:24:56 -07:00
CMakeLists.txt license: cleanup: add SPDX Apache-2.0 license identifier 2019-04-07 08:45:22 -04:00
Kconfig tests/kernel/mem_protect/stackprot: stack size adjust 2019-04-12 10:06:43 -04:00
Kconfig.power_mgmt power: modify HAS_STATE_SLEEP_ Kconfig options 2019-03-26 13:27:55 -04:00
atomic_c.c kernel: fix atomic ops in user mode on some arches 2019-03-18 09:18:00 -04:00
compiler_stack_protect.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
device.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
errno.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
idle.c power: clean up system power managment function names 2019-03-26 13:27:55 -04:00
init.c kernel: demote K_THREAD_STACK_BUFFER() to private 2019-04-05 16:10:02 -04:00
int_latency_bench.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
mailbox.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
mem_domain.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
mem_slab.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
mempool.c kernel: Make statements evaluate boolean expressions 2019-03-26 14:31:29 -04:00
msg_q.c kernel: Make if/iteration evaluate boolean operands 2019-03-26 22:06:45 -04:00
mutex.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
pipes.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
poll.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
queue.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
sched.c kernel: sched: move stack sentinel check earlier 2019-03-29 22:13:40 -04:00
sem.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
smp.c kernel/sched: arch/x86_64: Support synchronous k_thread_abort() in SMP 2019-03-13 19:15:20 +01:00
stack.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
system_work_q.c kernel: system_work_q: Set dedicated "sysworkq" name. 2018-10-19 07:58:45 -04:00
thread.c kernel: enforce usage of CONFIG_TEST_USERSPACE 2019-04-06 14:30:42 -04:00
thread_abort.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
timeout.c kernel: Make if/iteration evaluate boolean operands 2019-03-26 22:06:45 -04:00
timer.c all: Add 'U' suffix when using unsigned variables 2019-03-28 17:15:58 -05:00
userspace.c userspace: fix copy from user locking 2019-04-18 17:13:08 -04:00
userspace_handler.c all: Update reserved function names 2019-03-11 13:48:42 -04:00
version.c doc: add kernel version API to doxygen 2018-12-08 17:24:53 -05:00
work_q.c kernel: Make if/iteration evaluate boolean operands 2019-03-26 22:06:45 -04:00