tests: mem_protect/userspace: use kconfig for other stack tests
This uses the newly introduced CONFIG_MEM_DOMAIN_ISOLATED_STACKS to determine whether to proceed with the tests to access other threads' stacks. This provides more precise control on when to run or skip these tests. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
e6abc035c8
commit
8426a05e0e
1 changed files with 14 additions and 16 deletions
|
@ -553,17 +553,16 @@ ZTEST_USER(userspace, test_read_other_stack)
|
||||||
/* Try to read from another thread's stack. */
|
/* Try to read from another thread's stack. */
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
#if defined(CONFIG_MMU) || defined(CONFIG_MPU)
|
#if !defined(CONFIG_MEM_DOMAIN_ISOLATED_STACKS)
|
||||||
#if defined(CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API)
|
/* The minimal requirement to support memory domain permits
|
||||||
/* With memory domain enabled, all threads within the same domain
|
* threads of the same memory domain to access each others' stacks.
|
||||||
* have access to each other threads' stacks, especially with
|
* Some architectures supports further restricting access which
|
||||||
* CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API=y (as it is expected
|
* can be enabled via a kconfig. So if the kconfig is not enabled,
|
||||||
* behavior). The access would not fault which the test expects.
|
* skip the test.
|
||||||
* So skip this test.
|
|
||||||
*/
|
*/
|
||||||
ztest_test_skip();
|
ztest_test_skip();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
k_thread_create(&test_thread, test_stack, STACKSIZE,
|
k_thread_create(&test_thread, test_stack, STACKSIZE,
|
||||||
uthread_read_body, &val, NULL, NULL,
|
uthread_read_body, &val, NULL, NULL,
|
||||||
-1, K_USER | K_INHERIT_PERMS,
|
-1, K_USER | K_INHERIT_PERMS,
|
||||||
|
@ -583,17 +582,16 @@ ZTEST_USER(userspace, test_write_other_stack)
|
||||||
/* Try to write to another thread's stack. */
|
/* Try to write to another thread's stack. */
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
#if defined(CONFIG_MMU) || defined(CONFIG_MPU)
|
#if !defined(CONFIG_MEM_DOMAIN_ISOLATED_STACKS)
|
||||||
#if defined(CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API)
|
/* The minimal requirement to support memory domain permits
|
||||||
/* With memory domain enabled, all threads within the same domain
|
* threads of the same memory domain to access each others' stacks.
|
||||||
* have access to each other threads' stacks, especially with
|
* Some architectures supports further restricting access which
|
||||||
* CONFIG_ARCH_MEM_DOMAIN_SYNCHRONOUS_API=y (as it is expected
|
* can be enabled via a kconfig. So if the kconfig is not enabled,
|
||||||
* behavior). The access would not fault which the test expects.
|
* skip the test.
|
||||||
* So skip this test.
|
|
||||||
*/
|
*/
|
||||||
ztest_test_skip();
|
ztest_test_skip();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
k_thread_create(&test_thread, test_stack, STACKSIZE,
|
k_thread_create(&test_thread, test_stack, STACKSIZE,
|
||||||
uthread_write_body, &val, NULL, NULL,
|
uthread_write_body, &val, NULL, NULL,
|
||||||
-1, K_USER | K_INHERIT_PERMS,
|
-1, K_USER | K_INHERIT_PERMS,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue