From 6f25384e7a2f2ced65bac3fec82c6a0b0fdcbc8b Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Thu, 2 Jan 2020 18:29:36 -0800 Subject: [PATCH] tests: userspace: work around x86_64 bug Exceptions on x86_64 are incorrectly implemented, and if a preemptible thread faults, and in its overridden k_sys_fatal_error_handler() does something which invokes a scheduling point (such as here where we give semaphores), the thread will be swapped out on the per-CPU exception stack and probably explode when it is switched back in. For now, change the faulting thread priority to co-op so this doesn't happen. Workaround for #21462 Signed-off-by: Andrew Boie --- tests/kernel/mem_protect/userspace/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/mem_protect/userspace/src/main.c b/tests/kernel/mem_protect/userspace/src/main.c index 617b8715e62..969ebe08e1c 100644 --- a/tests/kernel/mem_protect/userspace/src/main.c +++ b/tests/kernel/mem_protect/userspace/src/main.c @@ -787,7 +787,7 @@ static void spawn_user(void) k_thread_create(&kthread_thread, kthread_stack, STACKSIZE, user_ctx_switch_half, NULL, NULL, NULL, - K_PRIO_PREEMPT(1), K_INHERIT_PERMS | K_USER, + -1, K_INHERIT_PERMS | K_USER, K_NO_WAIT); k_sem_take(&uthread_end_sem, K_FOREVER);