Skip to content

Commit 545d40e

Browse files
dcpleungcfriedt
authored andcommitted
tests: mem_protect/userspace: add thread switching tests
This adds a few tests to test switching between threads where they are under different memory domains. This is mainly to test if permissions are set correctly during context switch. By default the new tests are disabled and must be explicitly enabled. This is due to some architectures requiring some config changes (for example, x86 needing more reserved memory domains, and ARM64 needing more translation tables). To avoid causing mass CI failures, only enable platforms that have been tested, for now. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent 1a6a1bf commit 545d40e

12 files changed

+265
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2025 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
mainmenu "Userspace test"
6+
7+
source "Kconfig.zephyr"
8+
9+
config USERSPACE_SWITCHING_TESTS
10+
bool "Run thread switching tests"
11+
select SCHED_CPU_MASK if MP_MAX_NUM_CPUS > 1
12+
help
13+
Run userspace_domain_switching tests.
14+
15+
Enable this via board overlay.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_MAX_THREAD_BYTES=3
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_MAX_THREAD_BYTES=3
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_MAX_XLAT_TABLES=24
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_MAX_XLAT_TABLES=24
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_X86_MAX_ADDITIONAL_MEM_DOMAINS=4
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_X86_MAX_ADDITIONAL_MEM_DOMAINS=4
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_X86_MAX_ADDITIONAL_MEM_DOMAINS=4
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_X86_MAX_ADDITIONAL_MEM_DOMAINS=4
2+
CONFIG_USERSPACE_SWITCHING_TESTS=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_USERSPACE_SWITCHING_TESTS=y

0 commit comments

Comments
 (0)