85#define INHERIT_STACK_SIZE CONFIG_MAIN_STACK_SIZE
86#define SEMAPHORE_MAX_COUNT (10)
87#define SEMAPHORE_INIT_COUNT (0)
88#define SYNC_SEM_MAX_COUNT (1)
89#define SYNC_SEM_INIT_COUNT (0)
90#define MSG_Q_SIZE (10)
91#define MSG_Q_MAX_NUM_MSGS (10)
92#define MSG_Q_ALIGN (2)
94#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
95#define BLK_SIZE_MIN 16
96#define BLK_SIZE_MAX 64
99#define BLK_ALIGN BLK_SIZE_MIN
100#define SEM_INIT_VAL (0U)
101#define SEM_MAX_VAL (1U)
104#define MEM_DOMAIN_STACK_SIZE CONFIG_MAIN_STACK_SIZE
105#define MEM_PARTITION_INIT_NUM (1)
106#define BLK_SIZE_MIN_MD 8
107#define BLK_SIZE_MAX_MD 16
108#define BLK_NUM_MAX_MD 4
109#define BLK_ALIGN_MD BLK_SIZE_MIN_MD
110#define DESC_SIZE sizeof(struct sys_mem_pool_block)
111#define STACK_SIZE_MD (512 + CONFIG_TEST_EXTRA_STACKSIZE)
114#if defined(CONFIG_X86)
115#define MEM_REGION_ALLOC (4096)
116#elif defined(CONFIG_ARC)
117#define MEM_REGION_ALLOC (Z_ARC_MPU_ALIGN)
118#elif defined(CONFIG_ARM64)
119#define MEM_REGION_ALLOC (4096)
120#elif defined(CONFIG_ARM)
121#define MEM_REGION_ALLOC (Z_THREAD_MIN_STACK_ALIGN)
122#elif defined(CONFIG_RISCV)
123#define MEM_REGION_ALLOC (Z_RISCV_PMP_ALIGN)
125#error "Test suite not compatible for the given architecture"
127#define MEM_DOMAIN_ALIGNMENT __aligned(MEM_REGION_ALLOC)
130#define KOBJECT_STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
134#if defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
135#define TEST_HEAP_SIZE (2 << CONFIG_MAX_THREAD_BYTES) * 1024
138#define TEST_HEAP_SIZE (2 << CONFIG_MAX_THREAD_BYTES) * 256
142#ifndef _TEST_SYSCALLS_H_
143#define _TEST_SYSCALLS_H_
147#include <syscalls/mem_protect.h>
void test_macros_obtain_names_data_bss(void)
void test_mem_domain_remove_part_fail(void)
Definition: mem_domain.c:463
void test_kobject_perm_error(void)
Test grant access failed in user mode.
Definition: kobject.c:1340
void test_mem_domain_boot_threads(void)
Show that boot threads belong to the default memory domain.
Definition: mem_domain.c:257
void test_thread_has_residual_permissions(void)
Test access permission of a terminated thread.
Definition: kobject.c:440
void test_create_new_higher_prio_thread_from_user(void)
Thread creation with prority is higher than current thread.
Definition: kobject.c:964
void test_kobject_access_invalid_kobject(void)
Object validation checks.
Definition: kobject.c:496
void test_kobject_revoke_access(void)
Test access revoke.
Definition: kobject.c:211
void test_mem_domain_invalid_access(void)
Show that a user thread can't touch partitions not in its domain.
Definition: mem_domain.c:155
void test_create_new_thread_from_user(void)
Test thread create from a user thread and check permissions.
Definition: kobject.c:628
void test_thread_alloc_out_of_idx(void)
Definition: kobject.c:1196
void test_mem_domain_no_writes_to_ro(void)
Show that a read-only partition can't be written to.
Definition: mem_domain.c:167
void test_mem_part_assert_add_overmax(void)
Test system assert when adding memory partitions more than possible.
Definition: mem_domain.c:417
void test_kobject_release_null(void)
Definition: kobject.c:363
void test_kobject_grant_access_kobj(void)
Test access revoke.
Definition: kobject.c:258
void test_kobject_access_all_grant_error(void)
Test grant access to all the kobject for thread.
Definition: kobject.c:120
void test_create_new_invalid_prio_thread_from_user(void)
Create a new thread whose prority is invalid.
Definition: kobject.c:1011
void test_kobject_access_all_grant(void)
Test supervisor thread grants kernel objects all access public status.
Definition: kobject.c:391
void test_kobject_access_grant_to_invalid_thread(void)
Test grant access to a valid kobject but invalid thread id.
Definition: kobject.c:475
void test_kobject_access_grant_error(void)
Test grant access of given NULL kobject.
Definition: kobject.c:66
void test_permission_inheritance(void)
Test object permission inheritance except of the parent thread object.
Definition: inherit.c:101
void test_thread_without_kobject_permission(void)
Test user thread can access a k_object without grant.
Definition: kobject.c:180
void test_mem_domain_migration(void)
Definition: mem_domain.c:307
static void set_fault_valid(bool valid)
Definition: mem_protect.h:74
void test_alloc_kobjects(void)
Test kernel object allocation.
Definition: kobject.c:1248
void test_mem_part_assign_bss_vars_zero(void)
void test_kobject_init_error(void)
Test alloc an invalid kernel object.
Definition: kobject.c:1130
void test_kobject_access_grant_error_user(void)
Test grant access of given NULL thread in usermode.
Definition: kobject.c:81
void test_create_new_thread_from_user_no_access_stack(void)
Test creates new thread from usermode without stack access.
Definition: kobject.c:722
void test_kobject_free_error(void)
Test free an invalid kernel object.
Definition: kobject.c:1103
void test_create_new_supervisor_thread_from_user(void)
Test to create a new supervisor thread from user.
Definition: kobject.c:874
void test_mem_domain_setup(void)
Definition: mem_domain.c:45
void test_mem_part_overlap(void)
Test system assert when new partition overlaps the existing partition.
Definition: mem_domain.c:379
volatile bool valid_fault
Definition: common.c:9
struct k_heap * ret_resource_pool_ptr(void)
void test_mem_domain_api_supervisor_only(void)
Test access memory domain APIs allowed to supervisor threads only.
Definition: mem_domain.c:239
void test_kobject_grant_access_kobj_invalid(void)
Test access grant between threads.
Definition: kobject.c:304
void test_kobject_access_grant(void)
Test access to a invalid semaphore who's address is NULL.
Definition: kobject.c:41
void test_mem_domain_init_fail(void)
Test error case of initializing memory domain fail.
Definition: mem_domain.c:479
void test_mem_domain_remove_add_partition(void)
Show that adding/removing partitions works.
Definition: mem_domain.c:182
void test_inherit_resource_pool(void)
Test child thread inherits parent's thread resource pool.
Definition: inherit.c:172
void test_kobject_release_from_user(void)
Test revoke permission of a k_object from userspace.
Definition: kobject.c:338
void test_krnl_obj_static_alloc_build_time(void)
void test_kobj_create_out_of_memory(void)
Test kernel object until out of memory.
Definition: kobject.c:1153
void test_kobject_reinitialize_thread_kobj(void)
Test to reinitialize the k_thread object.
Definition: kobject.c:582
void test_access_kobject_without_init_with_access(void)
Test syscall on a kobject which is not initialized and has access.
Definition: kobject.c:539
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.
Definition: kobject.c:678
void test_mark_thread_exit_uninitialized(void)
Test when thread exits, kernel marks stack objects uninitialized.
Definition: kobject.c:1054
void test_kobject_access_grant_error_user_null(void)
Test grant access of given NULL kobject in usermode.
Definition: kobject.c:103
void test_create_new_thread_from_user_invalid_stacksize(void)
Test to validate user thread spawning with stack overflow.
Definition: kobject.c:766
void test_access_kobject_without_init_access(void)
Object validation checks without init access.
Definition: kobject.c:514
void test_create_new_thread_from_user_huge_stacksize(void)
Test to check stack overflow from user thread.
Definition: kobject.c:820
void test_create_new_essential_thread_from_user(void)
Create a new essential thread from user.
Definition: kobject.c:918
void test_mem_part_auto_determ_size(void)
void test_mem_domain_valid_access(void)
Check if the mem_domain is configured and accessible for userspace.
Definition: mem_domain.c:144
void test_syscall_invalid_kobject(void)
Test syscall can take a different type of kobject.
Definition: kobject.c:149
Definition: kernel.h:5088