|
Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
|
Macros | |
| #define | PRIO K_PRIO_PREEMPT(1) |
| Show that moving a thread from one domain to another works. | |
Functions | |
| void | test_k_mem_map_phys_bare_rw (void) |
| Show that mapping an irregular size buffer works and RW flag is respected. | |
| void | test_k_mem_map_phys_bare_exec (void) |
| Show that mapping with/without K_MEM_PERM_EXEC works as expected. | |
| void | test_k_mem_map_phys_bare_side_effect (void) |
| Show that memory mapping doesn't have unintended side effects. | |
| void | test_k_mem_unmap_phys_bare (void) |
| Test that k_mem_unmap_phys_bare() unmaps the memory and it is no longer accessible afterwards. | |
| void | test_k_mem_map_phys_bare_unmap_reclaim_addr (void) |
| Show that k_mem_unmap_phys_bare() can reclaim the virtual region correctly. | |
| void | test_permission_inheritance (void) |
| Test object permission inheritance except of the parent thread object. | |
| void | test_inherit_resource_pool (void) |
| Test child thread inherits parent's thread resource pool. | |
| void | test_kobject_access_grant (void) |
| Test access to a invalid semaphore who's address is NULL. | |
| void | test_kobject_access_grant_error (void) |
| Test grant access of given NULL kobject. | |
| void | test_kobject_access_grant_error_user (void) |
| Test grant access of given NULL thread in usermode. | |
| void | test_kobject_access_grant_error_user_null (void) |
| Test grant access of given NULL kobject in usermode. | |
| void | test_kobject_access_all_grant_error (void) |
| Test grant access to all the kobject for thread. | |
| void | test_syscall_invalid_kobject (void) |
| Test syscall can take a different type of kobject. | |
| void | test_thread_without_kobject_permission (void) |
| Test user thread can access a k_object without grant. | |
| void | test_kobject_revoke_access (void) |
| Test access revoke. | |
| void | test_kobject_grant_access_kobj (void) |
| Test access revoke. | |
| void | test_kobject_grant_access_kobj_invalid (void) |
| Test access grant between threads. | |
| void | test_kobject_release_from_user (void) |
| Test revoke permission of a k_object from userspace. | |
| void | test_kobject_invalid (void) |
| Test release and access grant an invalid kobject. | |
| void | test_kobject_access_all_grant (void) |
| Test supervisor thread grants kernel objects all access public status. | |
| void | test_thread_has_residual_permissions (void) |
| Test access permission of a terminated thread. | |
| void | test_kobject_access_grant_to_invalid_thread (void) |
| Test grant access to a valid kobject but invalid thread id. | |
| void | test_kobject_access_invalid_kobject (void) |
| Object validation checks. | |
| void | test_access_kobject_without_init_access (void) |
| Object validation checks without init access. | |
| void | test_access_kobject_without_init_with_access (void) |
| Test syscall on a kobject which is not initialized and has access. | |
| void | test_kobject_reinitialize_thread_kobj (void) |
| Test to reinitialize the k_thread object. | |
| void | test_create_new_thread_from_user (void) |
| Test thread create from a user thread and check permissions. | |
| void | test_new_user_thread_with_in_use_stack_obj (void) |
| Test create new user thread from a user thread with in-use stack obj. | |
| void | test_create_new_thread_from_user_no_access_stack (void) |
| Test creates new thread from usermode without stack access. | |
| void | test_create_new_thread_from_user_invalid_stacksize (void) |
| Test to validate user thread spawning with stack overflow. | |
| void | test_create_new_thread_from_user_huge_stacksize (void) |
| Test to check stack overflow from user thread. | |
| void | test_create_new_supervisor_thread_from_user (void) |
| Test to create a new supervisor thread from user. | |
| void | test_create_new_essential_thread_from_user (void) |
| Create a new essential thread from user. | |
| void | test_create_new_higher_prio_thread_from_user (void) |
| Thread creation with priority is higher than current thread. | |
| void | test_create_new_invalid_prio_thread_from_user (void) |
| Create a new thread whose priority is invalid. | |
| void | test_mark_thread_exit_uninitialized (void) |
| Test when thread exits, kernel marks stack objects uninitialized. | |
| void | test_kobject_free_error (void) |
| Test free an invalid kernel object. | |
| void | test_kobject_init_error (void) |
| Test alloc an invalid kernel object. | |
| void | test_kobj_create_out_of_memory (void) |
| Test kernel object until out of memory. | |
| void | test_alloc_kobjects (void) |
| Test kernel object allocation. | |
| void | test_kobject_perm_error (void) |
| Test grant access failed in user mode. | |
| void | test_all_kobjects_str (void) |
| Test get all kernel object list. | |
| void | test_mem_domain_valid_access (void) |
| Check if the mem_domain is configured and accessible for userspace. | |
| void | test_mem_domain_invalid_access (void) |
| Show that a user thread can't touch partitions not in its domain. | |
| void | test_mem_domain_no_writes_to_ro (void) |
| Show that a read-only partition can't be written to. | |
| void | test_mem_domain_remove_add_partition (void) |
| Show that adding/removing partitions works. | |
| void | test_mem_domain_api_supervisor_only (void) |
| Test access memory domain APIs allowed to supervisor threads only. | |
| void | test_mem_domain_boot_threads (void) |
| Show that boot threads belong to the default memory domain. | |
| void | test_mem_part_overlap (void) |
| Test system assert when new partition overlaps the existing partition. | |
| void | test_mem_part_assert_add_overmax (void) |
| Test system assert when adding memory partitions more than possible. | |
| void | test_mem_domain_init_fail (void) |
| Test error case of initializing memory domain fail. | |
| void | test_mem_part_add_error_null (void) |
| Test error case of adding null memory partition fail. | |
| void | test_mem_part_add_error_zerosize (void) |
| Test error case of adding zero sized memory partition fail. | |
| void | test_mem_part_error_wraparound (void) |
| Test error case of memory partition address wraparound. | |
| void | test_mem_part_remove_error_zerosize (void) |
| Test error case of removing memory partition fail. | |
| static volatile | K_APP_DMEM (ztest_mem_partition) |
| Test assigning global data and BSS variables to memory partitions. | |
| K_APP_BMEM (part_arch) | |
| Test partitions sized per the constraints of the MPU hardware. | |
| void | test_generic_object (void) |
| Test to verify object permission. | |
| void | test_kobj_assign_perms_on_alloc_obj (void) |
| Test requestor thread will implicitly be assigned permission on the dynamically allocated object. | |
| void | test_no_ref_dyn_kobj_release_mem (void) |
| Test dynamically allocated kernel object release memory. | |
| void | test_write_ro (void) |
| Test write to read only section. | |
| void | test_write_text (void) |
| Test to execute on text section. | |
| void | test_exec_data (void) |
| Test execution from data section. | |
| void | test_exec_stack (void) |
| Test execution from stack section. | |
| void | test_exec_heap (void) |
| Test execution from heap. | |
| TOOLCHAIN_ENABLE_GCC_WARNING (TOOLCHAIN_WARNING_DANGLING_POINTER) | |
| Test stack pointer randomization. | |
| void | test_stackprot (void) |
| test Stack Protector feature using canary | |
| void | test_create_alt_thread (void) |
| Test optional mechanism to detect stack overflow. | |
| void | test_canary_value (void) |
| Test stack canaries behavior. | |
| void | test_guard_page_front (void) |
| Test faulting on front guard page. | |
| void | test_guard_page_rear (void) |
| Test faulting on rear guard page. | |
| void | test_guard_page_front_user (void) |
| Test faulting on front guard page in user mode. | |
| void | test_guard_page_rear_user (void) |
| Test faulting on rear guard page in user mode. | |
| void | test_string_nlen (void) |
| Test to demonstrate usage of k_usermode_string_nlen() | |
| void | test_user_string_alloc_copy (void) |
| Test to verify syscall for string alloc copy. | |
| void | test_user_string_copy (void) |
| Test sys_call for string copy. | |
| void | test_to_copy (void) |
| Test to demonstrate system call for copy. | |
| void | test_is_usermode (void) |
| Test to check if the thread is in user mode. | |
| void | test_write_control (void) |
| Test to write to a control register. | |
| void | test_disable_mmu_mpu (void) |
| Test to disable memory protection. | |
| void | test_read_kernram (void) |
| Test to read from kernel RAM. | |
| void | test_write_kernram (void) |
| Test to write to kernel RAM. | |
| void | test_write_kernro (void) |
| Test to write kernel RO. | |
| void | test_write_kerntext (void) |
| Test to write to kernel text section. | |
| void | test_read_kernel_data (void) |
| Test to read from kernel data section. | |
| void | test_write_kernel_data (void) |
| Test to write to kernel data section. | |
| K_APP_DMEM (default_part) volatile | |
| Test to read privileged stack. | |
| void | test_write_priv_stack (void) |
| Test to write to privilege stack. | |
| K_APP_BMEM (default_part) | |
| Test to pass a user object to system call. | |
| void | test_pass_noperms_object (void) |
| Test to pass object to a system call without permissions. | |
| void | test_start_kernel_thread (void) |
| Test to start kernel thread from usermode. | |
| void | test_read_other_stack (void) |
| Test to read from another thread's stack. | |
| void | test_write_other_stack (void) |
| Test to write to other thread's stack. | |
| void | test_revoke_noperms_object (void) |
| Test to revoke access to kobject without permission. | |
| void | test_access_after_revoke (void) |
| Test to access object after revoking access. | |
| void | test_user_mode_enter (void) |
| Test to check supervisor thread enter one-way to usermode. | |
| void | test_write_kobject_user_pipe (void) |
| Test to write to kobject using pipe. | |
| void | test_read_kobject_user_pipe (void) |
| Test to read from kobject using pipe. | |
| void | test_1st_init_and_access_other_memdomain (void) |
| Test creation of new memory domains. | |
| void | test_domain_add_thread_drop_to_user (void) |
| Show that changing between memory domains and dropping to user mode works as expected. | |
| void | test_domain_remove_part_drop_to_user (void) |
| Show that self-removing a partition from a domain we are a member of, and then dropping to user mode faults as expected. | |
| void | test_domain_add_thread_context_switch (void) |
| Show that changing between memory domains and then switching to another thread in the same domain works as expected. | |
| void | test_domain_remove_part_context_switch (void) |
| Show that self-removing a partition from a domain we are a member of, and then switching to another user thread in the same domain faults as expected. | |
| void | test_unimplemented_syscall (void) |
| Test unimplemented system call. | |
| void | test_bad_syscall (void) |
| Test bad syscall handler. | |
| void | test_object_recycle (void) |
| Test recycle object. | |
| void | test_access_kernel_obj_with_priv_data (void) |
| Test access kernel object with private data using system call. | |
| void | test_stack_buffer (void) |
| Test kernel provides user thread read/write access to its own stack memory buffer. | |
| void | test_idle_stack (void) |
| Show that the idle thread stack size is correct. | |
| void | test_user_corrupt_stack_pointer (void) |
| Test sys_call does not write to user stack. | |
| void | test_syscall_cpu_scrubs_regs (void) |
| Test CPU scrubs registers after system call. | |
| void | test_ram_perms (void) |
| Test that MMU flags on RAM virtual address range are set properly. | |
| void | test_null_map (void) |
| Test that the NULL virtual page is always non-present. | |
| void | test_dump_ptables_user (void) |
| Dump kernel's page tables to console. | |
| #define PRIO K_PRIO_PREEMPT(1) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Show that moving a thread from one domain to another works.
Start a thread and have it spin. Then while it is spinning, show that adding it to another memory domain doesn't cause any faults.
This test is of particular importance on SMP systems where the child thread is spinning on a different CPU concurrently with the migration operation.
| K_APP_BMEM | ( | default_part | ) | volatile |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to pass a user object to system call.
| K_APP_BMEM | ( | part_arch | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_partition.c>
Test partitions sized per the constraints of the MPU hardware.
| K_APP_DMEM | ( | default_part | ) | volatile |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to read privileged stack.
|
static |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_partition.c>
Test assigning global data and BSS variables to memory partitions.
Test that system supports application assigning global data and BSS variables using macros K_APP_BMEM() and K_APP_DMEM
| void test_1st_init_and_access_other_memdomain | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test creation of new memory domains.
We initialize a new memory domain and show that its partition configuration is correct. This new domain has "alt_part" in it, but not "default_part". We then try to modify data in "default_part" and show it produces an exception since that partition is not in the new domain.
This caught a bug once where an MMU system copied page tables for the new domain and accidentally copied memory partition permissions from the source page tables, allowing the write to "default_part" to work.
| void test_access_after_revoke | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to access object after revoking access.
| void test_access_kernel_obj_with_priv_data | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/queue/src/test_queue_contexts.c>
Test access kernel object with private data using system call.
| void test_access_kobject_without_init_access | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Object validation checks without init access.
Test syscall on a kobject which is not initialized and has no access
| void test_access_kobject_without_init_with_access | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test syscall on a kobject which is not initialized and has access.
| void test_all_kobjects_str | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test get all kernel object list.
Get all of the kernel object in kobject list.
| void test_alloc_kobjects | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test kernel object allocation.
Allocate all kinds of kernel object and do permission operation functions.
| void test_bad_syscall | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test bad syscall handler.
When a system call handler decides to terminate the calling thread, the kernel will produce error which indicates the context, where the faulting system call was made from user code.
| void test_canary_value | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stackprot/src/main.c>
Test stack canaries behavior.
Test that canaries value are different between threads when CONFIG_STACK_CANARIES_TLS is enabled.
| void test_create_alt_thread | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stackprot/src/main.c>
Test optional mechanism to detect stack overflow.
Test that the system provides an optional mechanism to detect when supervisor threads overflow stack memory buffer.
| void test_create_new_essential_thread_from_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Create a new essential thread from user.
| void test_create_new_higher_prio_thread_from_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Thread creation with priority is higher than current thread.
_handler_k_thread_create validation.
| void test_create_new_invalid_prio_thread_from_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Create a new thread whose priority is invalid.
_handler_k_thread_create validation.
| void test_create_new_supervisor_thread_from_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test to create a new supervisor thread from user.
The system kernel must prevent user threads from creating supervisor threads.
| void test_create_new_thread_from_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test thread create from a user thread and check permissions.
| void test_create_new_thread_from_user_huge_stacksize | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_create_new_thread_from_user_invalid_stacksize | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_create_new_thread_from_user_no_access_stack | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_disable_mmu_mpu | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to disable memory protection.
| void test_domain_add_thread_context_switch | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Show that changing between memory domains and then switching to another thread in the same domain works as expected.
| void test_domain_add_thread_drop_to_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Show that changing between memory domains and dropping to user mode works as expected.
| void test_domain_remove_part_context_switch | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Show that self-removing a partition from a domain we are a member of, and then switching to another user thread in the same domain faults as expected.
| void test_domain_remove_part_drop_to_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Show that self-removing a partition from a domain we are a member of, and then dropping to user mode faults as expected.
| void test_dump_ptables_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/arch/x86/pagetables/src/main.c>
Dump kernel's page tables to console.
We don't verify any specific output, but this shouldn't crash
| void test_exec_data | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/protection/src/main.c>
Test execution from data section.
| void test_exec_heap | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/protection/src/main.c>
Test execution from heap.
| void test_exec_stack | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/protection/src/main.c>
Test execution from stack section.
| void test_generic_object | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/obj_validation/src/main.c>
Test to verify object permission.
| void test_guard_page_front | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stackprot/src/mapped_stack.c>
Test faulting on front guard page.
| void test_guard_page_front_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stackprot/src/mapped_stack.c>
Test faulting on front guard page in user mode.
| void test_guard_page_rear | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stackprot/src/mapped_stack.c>
Test faulting on rear guard page.
| void test_guard_page_rear_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stackprot/src/mapped_stack.c>
Test faulting on rear guard page in user mode.
| void test_idle_stack | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/threads/thread_stack/src/main.c>
Show that the idle thread stack size is correct.
The idle thread has to occasionally clean up self-exiting threads. Exercise this and show that we didn't overflow, reporting out stack usage.
| void test_inherit_resource_pool | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/inherit.c>
Test child thread inherits parent's thread resource pool.
| void test_is_usermode | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to check if the thread is in user mode.
| void test_k_mem_map_phys_bare_exec | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_map/src/main.c>
Show that mapping with/without K_MEM_PERM_EXEC works as expected.
| void test_k_mem_map_phys_bare_rw | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_map/src/main.c>
Show that mapping an irregular size buffer works and RW flag is respected.
| void test_k_mem_map_phys_bare_side_effect | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_map/src/main.c>
Show that memory mapping doesn't have unintended side effects.
| void test_k_mem_map_phys_bare_unmap_reclaim_addr | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_map/src/main.c>
Show that k_mem_unmap_phys_bare() can reclaim the virtual region correctly.
| void test_k_mem_unmap_phys_bare | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_map/src/main.c>
Test that k_mem_unmap_phys_bare() unmaps the memory and it is no longer accessible afterwards.
| void test_kobj_assign_perms_on_alloc_obj | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/obj_validation/src/main.c>
Test requestor thread will implicitly be assigned permission on the dynamically allocated object.
| void test_kobj_create_out_of_memory | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_kobject_access_all_grant | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_kobject_access_all_grant_error | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test grant access to all the kobject for thread.
Call function with a NULL parameter, an expected fault happened.
| void test_kobject_access_grant | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test access to a invalid semaphore who's address is NULL.
| void test_kobject_access_grant_error | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test grant access of given NULL kobject.
Call function with a NULL parameter in supervisor mode, nothing happened.
| void test_kobject_access_grant_error_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test grant access of given NULL thread in usermode.
Call function with NULL parameter, an expected fault happened.
| void test_kobject_access_grant_error_user_null | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test grant access of given NULL kobject in usermode.
Call function with a NULL parameter, an expected fault happened.
| void test_kobject_access_grant_to_invalid_thread | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test grant access to a valid kobject but invalid thread id.
| void test_kobject_access_invalid_kobject | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Object validation checks.
Test syscall on a kobject which is not present in the hash table.
| void test_kobject_free_error | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test free an invalid kernel object.
Spawn a thread free a NULL, an expected fault happened.
| void test_kobject_grant_access_kobj | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test access revoke.
| void test_kobject_grant_access_kobj_invalid | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test access grant between threads.
Test access grant to thread B from thread A which doesn't have required permissions.
| void test_kobject_init_error | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test alloc an invalid kernel object.
Allocate invalid kernel objects, then no allocation will be returned.
| void test_kobject_invalid | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test release and access grant an invalid kobject.
Validate release and access grant an invalid kernel object.
| void test_kobject_perm_error | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_kobject_reinitialize_thread_kobj | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test to reinitialize the k_thread object.
| void test_kobject_release_from_user | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test revoke permission of a k_object from userspace.
| void test_kobject_revoke_access | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
Test access revoke.
| void test_mark_thread_exit_uninitialized | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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
| void test_mem_domain_api_supervisor_only | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test access memory domain APIs allowed to supervisor threads only.
Show that invoking any of the memory domain APIs from user mode leads to a fault.
| void test_mem_domain_boot_threads | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Show that boot threads belong to the default memory domain.
Static threads and the main thread are supposed to start as members of the default memory domain. Prove this is the case by examining the memory domain membership of z_main_thread and a static thread.
| void test_mem_domain_init_fail | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test error case of initializing memory domain fail.
Try to initialize a domain with invalid partition. k_mem_domain_init() should return non-zero.
| void test_mem_domain_invalid_access | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Show that a user thread can't touch partitions not in its domain.
| void test_mem_domain_no_writes_to_ro | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Show that a read-only partition can't be written to.
| void test_mem_domain_remove_add_partition | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Show that adding/removing partitions works.
Show that removing a partition doesn't affect access to other partitions. Show that removing a partition generates a fault if its data is accessed. Show that adding a partition back restores access from a user thread.
| void test_mem_domain_valid_access | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Check if the mem_domain is configured and accessible for userspace.
Join a memory domain with a read-write memory partition and a read-only partition within it, and show that the data in the partition is accessible as expected by the permissions provided.
| void test_mem_part_add_error_null | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test error case of adding null memory partition fail.
Try to add a null partition to memory domain. k_mem_domain_add_partition() should return error.
| void test_mem_part_add_error_zerosize | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test error case of adding zero sized memory partition fail.
Try to add a zero sized partition to memory domain. k_mem_domain_add_partition() should return error.
| void test_mem_part_assert_add_overmax | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test system assert when adding memory partitions more than possible.
| void test_mem_part_error_wraparound | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test error case of memory partition address wraparound.
Try to add a partition whose address is wraparound. k_mem_domain_add_partition() should return error.
| void test_mem_part_overlap | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test system assert when new partition overlaps the existing partition.
Test Objective:
Testing techniques:
Prerequisite Conditions:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail Criteria:
Assumptions and Constraints:
| void test_mem_part_remove_error_zerosize | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/mem_domain.c>
Test error case of removing memory partition fail.
Try to remove a partition size mismatched will result in k_mem_domain_remove_partition() returning error.
| void test_new_user_thread_with_in_use_stack_obj | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_no_ref_dyn_kobj_release_mem | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/obj_validation/src/main.c>
Test dynamically allocated kernel object release memory.
Dynamically allocated kernel objects whose access is controlled by the permission system will use object permission as a reference count. If no threads have access to an object, the object's memory released.
| void test_null_map | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/arch/x86/pagetables/src/main.c>
Test that the NULL virtual page is always non-present.
| void test_object_recycle | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test recycle object.
Test recycle valid/invalid kernel object, see if perms_count changes as expected.
| void test_pass_noperms_object | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to pass object to a system call without permissions.
| void test_permission_inheritance | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/inherit.c>
Test object permission inheritance except of the parent thread object.
| void test_ram_perms | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/arch/x86/pagetables/src/main.c>
Test that MMU flags on RAM virtual address range are set properly.
| void test_read_kernel_data | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to read from kernel data section.
| void test_read_kernram | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to read from kernel RAM.
| void test_read_kobject_user_pipe | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to read from kobject using pipe.
| void test_read_other_stack | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to read from another thread's stack.
| void test_revoke_noperms_object | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to revoke access to kobject without permission.
User thread can only revoke their own access to an object. In that test user thread to revokes access to unathorized object, as a result the system will assert.
| void test_stack_buffer | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/threads/thread_stack/src/main.c>
Test kernel provides user thread read/write access to its own stack memory buffer.
Thread can access its own stack memory buffer and perform read/write operations.
| void test_stackprot | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stackprot/src/main.c>
test Stack Protector feature using canary
This is the test program to test stack protection using canary. The main thread starts a second thread, which generates a stack check failure. By design, the second thread will not complete its execution and will not set ret to TC_FAIL. This is the entry point to the test stack protection feature. It starts the thread that tests stack protection, then prints out a few messages before terminating.
| void test_start_kernel_thread | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to start kernel thread from usermode.
| void test_string_nlen | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/syscalls/src/main.c>
Test to demonstrate usage of k_usermode_string_nlen()
The test will be called from user mode and kernel mode to check the behavior of k_usermode_string_nlen()
| void test_syscall_cpu_scrubs_regs | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/arch/arm/arm_thread_swap/src/arm_syscalls.c>
Test CPU scrubs registers after system call.
Then in main test function below check registers values, if no 0xDEADBEEF value detected, that means CPU scrubbed registers before exit from the system call.
Then in main test function below check registers values, if no 0xDEADBEEF value detected, that means CPU scrubbed registers before exit from the system call.
| void test_syscall_invalid_kobject | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_thread_has_residual_permissions | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_thread_without_kobject_permission | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/mem_protect/src/kobject.c>
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.
| void test_to_copy | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/syscalls/src/main.c>
Test to demonstrate system call for copy.
| void test_unimplemented_syscall | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test unimplemented system call.
Created a syscall with name missing_syscall() without a verification function. The kernel shall safety handle invocations of unimplemented system calls.
| void test_user_corrupt_stack_pointer | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/arch/arm/arm_mem_protect/src/main.c>
Test sys_call does not write to user stack.
| void test_user_mode_enter | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to check supervisor thread enter one-way to usermode.
A thread running in supervisor mode must have one-way operation ability to drop privileges to user mode.
| void test_user_string_alloc_copy | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/syscalls/src/main.c>
Test to verify syscall for string alloc copy.
| void test_user_string_copy | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/syscalls/src/main.c>
Test sys_call for string copy.
| void test_write_control | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write to a control register.
| void test_write_kernel_data | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write to kernel data section.
| void test_write_kernram | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write to kernel RAM.
| void test_write_kernro | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write kernel RO.
| void test_write_kerntext | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write to kernel text section.
| void test_write_kobject_user_pipe | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write to kobject using pipe.
| void test_write_other_stack | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write to other thread's stack.
| void test_write_priv_stack | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/userspace/src/main.c>
Test to write to privilege stack.
| void test_write_ro | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/protection/src/main.c>
Test write to read only section.
| void test_write_text | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/protection/src/main.c>
Test to execute on text section.
| TOOLCHAIN_ENABLE_GCC_WARNING | ( | TOOLCHAIN_WARNING_DANGLING_POINTER | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/mem_protect/stack_random/src/main.c>
Test stack pointer randomization.