Please sign in to comment.
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 <email@example.com>
- Loading branch information...