assert: generate oops if invoked from usermode
User mode isn't allowed to generate a panic and this would lead to a confusing privilege violation exception. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
2d9032e5d0
commit
39425eaada
1 changed files with 12 additions and 3 deletions
|
@ -24,8 +24,17 @@
|
||||||
*/
|
*/
|
||||||
__weak void assert_post_action(const char *file, unsigned int line)
|
__weak void assert_post_action(const char *file, unsigned int line)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(file);
|
ARG_UNUSED(file);
|
||||||
ARG_UNUSED(line);
|
ARG_UNUSED(line);
|
||||||
|
|
||||||
k_panic();
|
#ifdef CONFIG_USERSPACE
|
||||||
|
/* User threads aren't allowed to induce kernel panics; generate
|
||||||
|
* an oops instead.
|
||||||
|
*/
|
||||||
|
if (_is_user_context()) {
|
||||||
|
k_oops();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
k_panic();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue