zephyr/arch/posix
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
..
core kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
include kernel: update arch_switch_to_main_thread() 2020-07-30 21:11:14 -04:00
CMakeLists.txt toolchain: improved toolchain abstraction for compilers and linker 2020-09-04 20:36:59 +02:00
Kconfig
Linux.aarch64.cmake posix arch: build on aarch64 / allow host-specific cmake includes 2020-05-09 12:17:24 +02:00