zephyr/arch/posix/core
Andrew Boie f5a7e1a108 kernel: handle thread self-aborts on idle thread
Fixes races where threads on another CPU are joining the
exiting thread, since it could still be running when
the joiners wake up on a different CPU.

Fixes problems where the thread object is still being
used by the kernel when the fn_abort() function is called,
preventing the thread object from being recycled or
freed back to a slab pool.

Fixes a race where a thread is aborted from one CPU while
it self-aborts on another CPU, that was currently worked
around with a busy-wait.

Precedent for doing this comes from FreeRTOS, which also
performs final thread cleanup in the idle thread.

Some logic in z_thread_single_abort() rearranged such that
when we release sched_spinlock, the thread object pointer
is never dereferenced by the kernel again; join waiters
or fn_abort() logic may free it immediately.

An assertion added to z_thread_single_abort() to ensure
it never gets called with thread == _current outside of an ISR.

Some logic has been added to ensure z_thread_single_abort()
tasks don't run more than once.

Fixes: #26486
Related to: #23063 #23062

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-30 14:11:59 -04:00
..
offsets kconfig: Rename CONFIG_FP_SHARING to CONFIG_FPU_SHARING 2020-05-08 10:58:33 +02:00
CMakeLists.txt arch: posix: isolate arch-soc/board IF from kernel-arch IF 2019-10-09 09:14:18 -04:00
cpuhalt.c arch: posix: Print warning on sys_reboot 2020-06-09 08:19:50 +02:00
fatal.c global: Remove leading/trailing blank lines in files 2019-12-11 19:17:27 +01:00
irq.c arch: Apply dynamic IRQ API change 2020-09-02 13:48:13 +02:00
posix_core.c kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
swap.c tracing: posix_arch: trace swap 2020-08-24 13:21:12 +02:00
thread.c kernel: overhaul stack specification 2020-07-30 21:11:14 -04:00