Memory Protection

Show that mapping an irregular size buffer works and RW flag is respected.

test_k_mem_map_phys_bare_rw()

Show that mapping with/without K_MEM_PERM_EXEC works as expected.

test_k_mem_map_phys_bare_exec()

Show that memory mapping doesn’t have unintended side effects.

test_k_mem_map_phys_bare_side_effect()

Test that k_mem_unmap_phys_bare() unmaps the memory and it is no longer accessible afterwards.

test_k_mem_unmap_phys_bare()

Show that k_mem_unmap_phys_bare() can reclaim the virtual region correctly.

test_k_mem_map_phys_bare_unmap_reclaim_addr()

Test object permission inheritance except of the parent thread object.

test_permission_inheritance()

Test child thread inherits parent’s thread resource pool.

test_inherit_resource_pool()

Test access to a invalid semaphore who’s address is NULL.

test_kobject_access_grant()

Test grant access of given NULL kobject.

test_kobject_access_grant_error()

Test grant access of given NULL thread in usermode.

test_kobject_access_grant_error_user()

Test grant access of given NULL kobject in usermode.

test_kobject_access_grant_error_user_null()

Test grant access to all the kobject for thread.

test_kobject_access_all_grant_error()

Test syscall can take a different type of kobject.

test_syscall_invalid_kobject()

Test user thread can access a k_object() without grant.

test_thread_without_kobject_permission()

Test access revoke.

test_kobject_revoke_access()

Test access revoke.

test_kobject_grant_access_kobj()

Test access grant between threads.

test_kobject_grant_access_kobj_invalid()

Test revoke permission of a k_object() from userspace.

test_kobject_release_from_user()

Test release and access grant an invalid kobject.

test_kobject_invalid()

Test supervisor thread grants kernel objects all access public status.

test_kobject_access_all_grant()

Test access permission of a terminated thread.

test_thread_has_residual_permissions()

Test grant access to a valid kobject but invalid thread id.

test_kobject_access_grant_to_invalid_thread()

Object validation checks.

test_kobject_access_invalid_kobject()

Object validation checks without init access.

test_access_kobject_without_init_access()

Test syscall on a kobject which is not initialized and has access.

test_access_kobject_without_init_with_access()

Test to reinitialize the k_thread() object.

test_kobject_reinitialize_thread_kobj()

Test thread create from a user thread and check permissions.

test_create_new_thread_from_user()

Test create new user thread from a user thread with in-use stack obj.

test_new_user_thread_with_in_use_stack_obj()

Test creates new thread from usermode without stack access.

test_create_new_thread_from_user_no_access_stack()

Test to validate user thread spawning with stack overflow.

test_create_new_thread_from_user_invalid_stacksize()

Test to check stack overflow from user thread.

test_create_new_thread_from_user_huge_stacksize()

Test to create a new supervisor thread from user.

test_create_new_supervisor_thread_from_user()

Create a new essential thread from user.

test_create_new_essential_thread_from_user()

Thread creation with priority is higher than current thread.

test_create_new_higher_prio_thread_from_user()

Create a new thread whose priority is invalid.

test_create_new_invalid_prio_thread_from_user()

Test when thread exits, kernel marks stack objects uninitialized.

test_mark_thread_exit_uninitialized()

Test free an invalid kernel object.

test_kobject_free_error()

Test alloc an invalid kernel object.

test_kobject_init_error()

Test kernel object until out of memory.

test_kobj_create_out_of_memory()

Test kernel object allocation.

test_alloc_kobjects()

Test grant access failed in user mode.

test_kobject_perm_error()

Test get all kernel object list.

test_all_kobjects_str()

Check if the mem_domain is configured and accessible for userspace.

test_mem_domain_valid_access()

Show that a user thread can’t touch partitions not in its domain.

test_mem_domain_invalid_access()

Show that a read-only partition can’t be written to.

test_mem_domain_no_writes_to_ro()

Show that adding/removing partitions works.

test_mem_domain_remove_add_partition()

Test access memory domain APIs allowed to supervisor threads only.

test_mem_domain_api_supervisor_only()

Show that boot threads belong to the default memory domain.

test_mem_domain_boot_threads()

Test system assert when new partition overlaps the existing partition.

test_mem_part_overlap()

Test system assert when adding memory partitions more than possible.

test_mem_part_assert_add_overmax()

Test error case of initializing memory domain fail.

test_mem_domain_init_fail()

Test error case of adding null memory partition fail.

test_mem_part_add_error_null()

Test error case of adding zero sized memory partition fail.

test_mem_part_add_error_zerosize()

Test error case of memory partition address wraparound.

test_mem_part_error_wraparound()

Test error case of removing memory partition fail.

test_mem_part_remove_error_zerosize()

Test to verify object permission.

test_generic_object()

Test requestor thread will implicitly be assigned permission on the dynamically allocated object.

test_kobj_assign_perms_on_alloc_obj()

Test dynamically allocated kernel object release memory.

test_no_ref_dyn_kobj_release_mem()

Test write to read only section.

test_write_ro()

Test to execute on text section.

test_write_text()

Test execution from data section.

test_exec_data()

Test execution from stack section.

test_exec_stack()

Test execution from heap.

test_exec_heap()

test Stack Protector feature using canary

test_stackprot()

Test optional mechanism to detect stack overflow.

test_create_alt_thread()

Test stack canaries behavior.

test_canary_value()

Test faulting on front guard page.

test_guard_page_front()

Test faulting on rear guard page.

test_guard_page_rear()

Test faulting on front guard page in user mode.

test_guard_page_front_user()

Test faulting on rear guard page in user mode.

test_guard_page_rear_user()

Test to demonstrate usage of k_usermode_string_nlen()

test_string_nlen()

Test to verify syscall for string alloc copy.

test_user_string_alloc_copy()

Test sys_call for string copy.

test_user_string_copy()

Test to demonstrate system call for copy.

test_to_copy()

Test to check if the thread is in user mode.

test_is_usermode()

Test to write to a control register.

test_write_control()

Test to disable memory protection.

test_disable_mmu_mpu()

Test to read from kernel RAM.

test_read_kernram()

Test to write to kernel RAM.

test_write_kernram()

Test to write kernel RO.

test_write_kernro()

Test to write to kernel text section.

test_write_kerntext()

Test to read from kernel data section.

test_read_kernel_data()

Test to write to kernel data section.

test_write_kernel_data()

Test to write to privilege stack.

test_write_priv_stack()

Test to pass object to a system call without permissions.

test_pass_noperms_object()

Test to start kernel thread from usermode.

test_start_kernel_thread()

Test to read from another thread’s stack.

test_read_other_stack()

Test to write to other thread’s stack.

test_write_other_stack()

Test to revoke access to kobject without permission.

test_revoke_noperms_object()

Test to access object after revoking access.

test_access_after_revoke()

Test to check supervisor thread enter one-way to usermode.

test_user_mode_enter()

Test to write to kobject using pipe.

test_write_kobject_user_pipe()

Test to read from kobject using pipe.

test_read_kobject_user_pipe()

Test creation of new memory domains.

test_1st_init_and_access_other_memdomain()

Show that changing between memory domains and dropping to user mode works as expected.

test_domain_add_thread_drop_to_user()

Show that self-removing a partition from a domain we are a member of, and then dropping to user mode faults as expected.

test_domain_remove_part_drop_to_user()

Show that changing between memory domains and then switching to another thread in the same domain works as expected.

test_domain_add_thread_context_switch()

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.

test_domain_remove_part_context_switch()

Test unimplemented system call.

test_unimplemented_syscall()

Test bad syscall handler.

test_bad_syscall()

Test recycle object.

test_object_recycle()

Test access kernel object with private data using system call.

test_access_kernel_obj_with_priv_data()

Test kernel provides user thread read/write access to its own stack memory buffer.

test_stack_buffer()

Show that the idle thread stack size is correct.

test_idle_stack()

Test sys_call does not write to user stack.

test_user_corrupt_stack_pointer()

Test CPU scrubs registers after system call.

test_syscall_cpu_scrubs_regs()

Test that MMU flags on RAM virtual address range are set properly.

test_ram_perms()

Test that the NULL virtual page is always non-present.

test_null_map()

Dump kernel’s page tables to console.

test_dump_ptables_user()