userspace: dynamic: Fix k_thread_stack_free verification
k_thread_stack_free syscall was not checking if the caller had permission to given stack object. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
ea288283a3
commit
c12f0507b6
1 changed files with 9 additions and 0 deletions
|
@ -166,6 +166,15 @@ int z_impl_k_thread_stack_free(k_thread_stack_t *stack)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static inline int z_vrfy_k_thread_stack_free(k_thread_stack_t *stack)
|
||||
{
|
||||
/* The thread stack object must not be in initialized state.
|
||||
*
|
||||
* Thread stack objects are initialized when the thread is created
|
||||
* and de-initialized whent the thread is destroyed. Since we can't
|
||||
* free a stack that is in use, we have to check that the caller
|
||||
* has access to the object but that it is not in use anymore.
|
||||
*/
|
||||
K_OOPS(K_SYSCALL_OBJ_NEVER_INIT(stack, K_OBJ_THREAD_STACK_ELEMENT));
|
||||
|
||||
return z_impl_k_thread_stack_free(stack);
|
||||
}
|
||||
#include <syscalls/k_thread_stack_free_mrsh.c>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue