|
Zephyr Project API
3.2.0
A Scalable Open Source RTOS
|
Functions | |
| K_THREAD_STACK_DEFINE (child_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
| K_THREAD_STACK_DEFINE (extra_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
| K_SEM_DEFINE (kobject_sem,(0),(10)) | |
| K_SEM_DEFINE (kobject_public_sem,(0),(10)) | |
| K_MUTEX_DEFINE (kobject_mutex) | |
| static void | kobject_access_grant_user_part (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_access_grant) | |
| Test access to a invalid semaphore who's address is NULL. More... | |
| ZTEST (mem_protect_kobj, test_kobject_access_grant_error) | |
| Test grant access of given NULL kobject. More... | |
| ZTEST_USER (mem_protect_kobj, test_kobject_access_grant_error_user) | |
| Test grant access of given NULL thread in usermode. More... | |
| ZTEST_USER (mem_protect_kobj, test_kobject_access_grant_error_user_null) | |
| Test grant access of given NULL kobject in usermode. More... | |
| ZTEST_USER (mem_protect_kobj, test_kobject_access_all_grant_error) | |
| Test grant access to all the kobject for thread. More... | |
| static void | syscall_invalid_kobject_user_part (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_syscall_invalid_kobject) | |
| Test syscall can take a different type of kobject. More... | |
| static void | thread_without_kobject_permission_user_part (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_thread_without_kobject_permission) | |
| Test user thread can access a k_object without grant. More... | |
| static void | kobject_revoke_access_user_part (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_revoke_access) | |
| Test access revoke. More... | |
| static void | kobject_grant_access_child_entry (void *p1, void *p2, void *p3) |
| static void | kobject_grant_access_extra_entry (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_grant_access_kobj) | |
| Test access revoke. More... | |
| static void | grant_access_kobj_invalid_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_grant_access_kobj_invalid) | |
| Test access grant between threads. More... | |
| static void | release_from_user_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_release_from_user) | |
| Test revoke permission of a k_object from userspace. More... | |
| ZTEST (mem_protect_kobj, test_kobject_invalid) | |
| Test release and access grant an invalid kobject. More... | |
| static void | access_all_grant_child_give (void *p1, void *p2, void *p3) |
| static void | access_all_grant_child_take (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_access_all_grant) | |
| Test supervisor thread grants kernel objects all access public status. More... | |
| static void | residual_permissions_child_success (void *p1, void *p2, void *p3) |
| static void | residual_permissions_child_fail (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_thread_has_residual_permissions) | |
| Test access permission of a terminated thread. More... | |
| ZTEST (mem_protect_kobj, test_kobject_access_grant_to_invalid_thread) | |
| Test grant access to a valid kobject but invalid thread id. More... | |
| ZTEST_USER (mem_protect_kobj, test_kobject_access_invalid_kobject) | |
| Object validation checks. More... | |
| ZTEST_USER (mem_protect_kobj, test_access_kobject_without_init_access) | |
| Object validation checks without init access. More... | |
| static void | without_init_with_access_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_access_kobject_without_init_with_access) | |
| Test syscall on a kobject which is not initialized and has access. More... | |
| static void | reinitialize_thread_kobj_extra (void *p1, void *p2, void *p3) |
| static void | reinitialize_thread_kobj_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_reinitialize_thread_kobj) | |
| Test to reinitialize the k_thread object. More... | |
| static void | new_thread_from_user_extra (void *p1, void *p2, void *p3) |
| static void | new_thread_from_user_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_thread_from_user) | |
| Test thread create from a user thread and check permissions. More... | |
| static void | new_thrd_from_user_with_in_use_stack (void *p1, void *p2, void *p3) |
| static void | new_user_thrd_child_with_in_use_stack (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_new_user_thread_with_in_use_stack_obj) | |
| Test create new user thread from a user thread with in-use stack obj. More... | |
| static void | from_user_no_access_stack_extra_entry (void *p1, void *p2, void *p3) |
| static void | from_user_no_access_stack_child_entry (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_thread_from_user_no_access_stack) | |
| Test creates new thread from usermode without stack access. More... | |
| static void | from_user_invalid_stacksize_extra (void *p1, void *p2, void *p3) |
| static void | from_user_invalid_stacksize_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_thread_from_user_invalid_stacksize) | |
| Test to validate user thread spawning with stack overflow. More... | |
| static void | user_huge_stacksize_extra (void *p1, void *p2, void *p3) |
| static void | user_huge_stacksize_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_thread_from_user_huge_stacksize) | |
| Test to check stack overflow from user thread. More... | |
| static void | supervisor_from_user_extra (void *p1, void *p2, void *p3) |
| static void | supervisor_from_user_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_supervisor_thread_from_user) | |
| Test to create a new supervisor thread from user. More... | |
| static void | essential_thread_from_user_extra (void *p1, void *p2, void *p3) |
| static void | essential_thread_from_user_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_essential_thread_from_user) | |
| Create a new essential thread from user. More... | |
| static void | higher_prio_from_user_extra (void *p1, void *p2, void *p3) |
| static void | higher_prio_from_user_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_higher_prio_thread_from_user) | |
| Thread creation with priority is higher than current thread. More... | |
| static void | invalid_prio_from_user_extra (void *p1, void *p2, void *p3) |
| static void | invalid_prio_from_user_child (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_create_new_invalid_prio_thread_from_user) | |
| Create a new thread whose priority is invalid. More... | |
| static void | thread_stack_init_objects (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_mark_thread_exit_uninitialized) | |
| Test when thread exits, kernel marks stack objects uninitialized. More... | |
| static void | tThread_object_free_error (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_free_error) | |
| Test free an invalid kernel object. More... | |
| ZTEST_USER (mem_protect_kobj, test_kobject_init_error) | |
| Test alloc an invalid kernel object. More... | |
| ZTEST (mem_protect_kobj, test_kobj_create_out_of_memory) | |
| Test kernel object until out of memory. More... | |
| ZTEST (mem_protect_kobj, test_thread_alloc_out_of_idx) | |
| ZTEST (mem_protect_kobj, test_alloc_kobjects) | |
| Test kernel object allocation. More... | |
| static void | entry_error_perm (void *p1, void *p2, void *p3) |
| ZTEST (mem_protect_kobj, test_kobject_perm_error) | |
| Test grant access failed in user mode. More... | |
| const char * | otype_to_str (enum k_objects otype) |
| ZTEST (mem_protect_kobj, test_all_kobjects_str) | |
| Test get all kernel object list. More... | |
| ZTEST_SUITE (mem_protect_kobj, NULL, NULL, NULL, NULL, NULL) | |
Variables | |
| struct k_thread | child_thread |
| struct k_thread | extra_thread |
| struct k_sem * | random_sem_type |
| struct k_sem | kobject_sem_not_hash_table |
| struct k_sem | kobject_sem_no_init_no_access |
| struct k_sem | kobject_sem_no_init_access |
| struct k_mem_slab | ms |
| struct k_msgq | mq |
| struct k_mutex | mutex |
| struct k_pipe | p |
| struct k_queue | q |
| struct k_poll_signal | ps |
| struct k_sem | sem |
| struct k_stack | s |
| struct k_thread | t |
| struct k_timer | timer |
| struct z_thread_stack_element | zs |
| struct k_futex | f |
| struct k_condvar | c |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| K_MUTEX_DEFINE | ( | kobject_mutex | ) |
| K_SEM_DEFINE | ( | kobject_public_sem | , |
| (0) | , | ||
| (10) | |||
| ) |
| K_SEM_DEFINE | ( | kobject_sem | , |
| (0) | , | ||
| (10) | |||
| ) |
| K_THREAD_STACK_DEFINE | ( | child_stack | , |
| (512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
| ) |
| K_THREAD_STACK_DEFINE | ( | extra_stack | , |
| (512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
| ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| const char * otype_to_str | ( | enum k_objects | otype | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| ZTEST | ( | mem_protect_kobj | , |
| test_access_kobject_without_init_with_access | |||
| ) |
Test syscall on a kobject which is not initialized and has access.
| ZTEST | ( | mem_protect_kobj | , |
| test_all_kobjects_str | |||
| ) |
Test get all kernel object list.
Get all of the kernel object in kobject list.
| ZTEST | ( | mem_protect_kobj | , |
| test_alloc_kobjects | |||
| ) |
Test kernel object allocation.
Allocate all kinds of kernel object and do permission operation functions.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_essential_thread_from_user | |||
| ) |
Create a new essential thread from user.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_higher_prio_thread_from_user | |||
| ) |
Thread creation with priority is higher than current thread.
_handler_k_thread_create validation.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_invalid_prio_thread_from_user | |||
| ) |
Create a new thread whose priority is invalid.
_handler_k_thread_create validation.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_supervisor_thread_from_user | |||
| ) |
Test to create a new supervisor thread from user.
The system kernel must prevent user threads from creating supervisor threads.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_thread_from_user | |||
| ) |
Test thread create from a user thread and check permissions.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_thread_from_user_huge_stacksize | |||
| ) |
Test to check stack overflow from user thread.
Create a new thread from user and use a stack bigger than allowed size. This is_handler_k_thread_create validation.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_thread_from_user_invalid_stacksize | |||
| ) |
Test to validate user thread spawning with stack overflow.
Create a new thread from user and use a huge stack size which overflows. This is _handler_k_thread_create validation.
| ZTEST | ( | mem_protect_kobj | , |
| test_create_new_thread_from_user_no_access_stack | |||
| ) |
Test creates new thread from usermode without stack access.
Create a new thread from user and the user doesn't have access to the stack region of new thread. _handler_k_thread_create validation.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobj_create_out_of_memory | |||
| ) |
Test kernel object until out of memory.
Create a dynamic kernel object repeatedly until run out of all heap memory, an expected out of memory error generated.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_access_all_grant | |||
| ) |
Test supervisor thread grants kernel objects all access public status.
System makes kernel object kobject_public_sem public to all threads Test the access to that kernel object by creating two new user threads.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_access_grant | |||
| ) |
Test access to a invalid semaphore who's address is NULL.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_access_grant_error | |||
| ) |
Test grant access of given NULL kobject.
Call function with a NULL parameter in supervisor mode, nothing happened.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_access_grant_to_invalid_thread | |||
| ) |
Test grant access to a valid kobject but invalid thread id.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_free_error | |||
| ) |
Test free an invalid kernel object.
Spawn a thread free a NULL, an expected fault happened.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_grant_access_kobj | |||
| ) |
Test access revoke.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_grant_access_kobj_invalid | |||
| ) |
Test access grant between threads.
Test access grant to thread B from thread A which doesn't have required permissions.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_invalid | |||
| ) |
Test release and access grant an invalid kobject.
Validate release and access grant an invalid kernel object.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_perm_error | |||
| ) |
Test grant access failed in user mode.
Before grant access of static kobject to user thread, any grant access to this thread, will trigger an expected thread permission error.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_reinitialize_thread_kobj | |||
| ) |
Test to reinitialize the k_thread object.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_release_from_user | |||
| ) |
Test revoke permission of a k_object from userspace.
| ZTEST | ( | mem_protect_kobj | , |
| test_kobject_revoke_access | |||
| ) |
Test access revoke.
| ZTEST | ( | mem_protect_kobj | , |
| test_mark_thread_exit_uninitialized | |||
| ) |
Test when thread exits, kernel marks stack objects uninitialized.
When thread exits, the kernel upon thread exit, should mark the exiting thread and thread stack object as uninitialized
| ZTEST | ( | mem_protect_kobj | , |
| test_new_user_thread_with_in_use_stack_obj | |||
| ) |
Test create new user thread from a user thread with in-use stack obj.
The kernel must prevent new user threads to use initialized (in-use) stack objects. In that case extra_thread is going to be create with in-use stack object child_stack. That will generate error, showing that kernel memory protection is working correctly.
| ZTEST | ( | mem_protect_kobj | , |
| test_syscall_invalid_kobject | |||
| ) |
Test syscall can take a different type of kobject.
Test syscall can take a different type of kobject and syscall will generate fatal error if check fails.
| ZTEST | ( | mem_protect_kobj | , |
| test_thread_alloc_out_of_idx | |||
| ) |
| ZTEST | ( | mem_protect_kobj | , |
| test_thread_has_residual_permissions | |||
| ) |
Test access permission of a terminated thread.
If a deleted thread with some permissions is recreated with the same tid, check if it still has the permissions.
| ZTEST | ( | mem_protect_kobj | , |
| test_thread_without_kobject_permission | |||
| ) |
Test user thread can access a k_object without grant.
The kernel will fail system call on kernel object that tracks thread permissions, on thread that don't have permission granted on the object.
| ZTEST_SUITE | ( | mem_protect_kobj | , |
| NULL | , | ||
| NULL | , | ||
| NULL | , | ||
| NULL | , | ||
| NULL | |||
| ) |
| ZTEST_USER | ( | mem_protect_kobj | , |
| test_access_kobject_without_init_access | |||
| ) |
Object validation checks without init access.
Test syscall on a kobject which is not initialized and has no access
| ZTEST_USER | ( | mem_protect_kobj | , |
| test_kobject_access_all_grant_error | |||
| ) |
Test grant access to all the kobject for thread.
Call function with a NULL parameter, an expected fault happened.
| ZTEST_USER | ( | mem_protect_kobj | , |
| test_kobject_access_grant_error_user | |||
| ) |
Test grant access of given NULL thread in usermode.
Call function with NULL parameter, an expected fault happened.
| ZTEST_USER | ( | mem_protect_kobj | , |
| test_kobject_access_grant_error_user_null | |||
| ) |
Test grant access of given NULL kobject in usermode.
Call function with a NULL parameter, an expected fault happened.
| ZTEST_USER | ( | mem_protect_kobj | , |
| test_kobject_access_invalid_kobject | |||
| ) |
Object validation checks.
Test syscall on a kobject which is not present in the hash table.
| ZTEST_USER | ( | mem_protect_kobj | , |
| test_kobject_init_error | |||
| ) |
Test alloc an invalid kernel object.
Allocate invalid kernel objects, then no allocation will be returned.
| struct k_condvar c |
| struct k_thread child_thread |
| struct k_thread extra_thread |
| struct k_futex f |
| struct k_sem kobject_sem_no_init_access |
| struct k_sem kobject_sem_no_init_no_access |
| struct k_sem kobject_sem_not_hash_table |
| struct k_msgq mq |
| struct k_mem_slab ms |
| struct k_mutex mutex |
| struct k_pipe p |
| struct k_poll_signal ps |
| struct k_queue q |
| struct k_sem* random_sem_type |
| struct k_stack s |
| struct k_sem sem |
| struct k_thread t |
| struct k_timer timer |
| struct z_thread_stack_element zs |