toggle quoted messageShow quoted text
I am using nxp frdm_k64f (has cortex M4 core).
In my application, I have a printf() at beginning. This is causing bus fault.
Replacing it with an infinite while(1) loop hides the bus fault but stack check still remains.
Further I tried running zephyr/tests/kernel/mem_protect/userspace.
It passes successfully.
However if I introduce a printf() in function userspace/src/main.c: umode_enter_func() under the condition when is_user_context is true, it also crashes.
But here it is different exception !!
***** USAGE FAULT *****
Executing thread ID (thread): 0x200002ec
Faulting instruction address: 0x61a0
Attempt to execute undefined instruction
Caught system error -- reason 0
Further decoding faulting instruction address 0x61a0 using 'addr2line' takes me to userspace/build/frdm_k64f/zephyr/priv_stacks_hash.gperf:32
The given line number is inside following function (at the location where variable map is being dereferenced to get priv_stack_addr).
u8_t *_k_priv_stack_find(void *obj)
const struct _k_priv_stack_map *map =
_k_priv_stack_map_lookup((const char *)obj, sizeof(void *));
I tried increasing MAIN/PREVILEDGED stack sizes in project config, but result is same.
From: Boie, Andrew P [mailto:firstname.lastname@example.org]
Sent: Tuesday, March 20, 2018 8:16 PM
To: Vakul Garg <email@example.com>; zephyr-
Cc: Andy Gross <firstname.lastname@example.org>
Subject: RE: k_thread_user_mode_enter() usage
It looks like you are getting two exceptions in a row.
Were you able to determine the source of the bus fault? That seems like the
What platform is this on?
From: email@example.com [mailto:zephyr-users-
firstname.lastname@example.org] On Behalf Of Vakul Garg
Sent: Tuesday, March 20, 2018 3:57 AM
Subject: [Zephyr-users] k_thread_user_mode_enter() usage
I want my application auto-launched at zephyr startup to drop its privileges
to become user mode app.
So I moved my applications entry point to app_main() and invoked it from
k_thread_user_mode_enter(app_main, NULL, NULL, NULL) from function
Now, before app_main() could get called, I get following error:
***** BUS FAULT *****
Executing thread ID (thread): 0x20002eec
Faulting instruction address: 0x12da
Precise data bus error
Fatal fault in thread 0x20002eec! Aborting.
***** Stack Check Fail! *****
Current thread ID = 0x20002eec
Faulting instruction address = 0x2a290
I checked that the stack sentinel check is failing in function
Can someone advise what I am doing wrong?
Zephyr-users mailing list