zephyr/kernel/include
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
..
gen_offset.h
kernel_arch_interface.h kernel: demote k_mem_map to z_mem_map 2020-09-03 14:24:38 -04:00
kernel_internal.h debug: x86: Add gdbstub for X86 2020-09-02 20:54:57 -04:00
kernel_offsets.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
ksched.h kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
kswap.h benchmarking: remove execution benchmarking code 2020-09-05 13:28:38 -05:00
offsets_short.h kernel: remove legacy fields in _kernel 2020-05-08 17:42:49 +02:00