zephyr/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
..
app_memory app_memdomain: ARC: adjust asembler directives for MWDT toolchain 2020-09-05 10:22:56 -05:00
arch ARC: linker: merge GNU and MWDT linker scripts 2020-09-18 09:49:09 -04:00
audio device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
bluetooth Bluetooth: L2CAP: Document behavior of alloc_buf 2020-09-22 10:56:27 +03:00
canbus subsys: canopen: Add a wrapper to avoid passing device to CO_init 2020-09-02 13:48:13 +02:00
cmsis_rtos_v1
cmsis_rtos_v2
console device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
crypto device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
data json: Add top-level array encoding support 2020-06-19 18:21:27 +02:00
debug debug: x86: Add gdbstub for X86 2020-09-02 20:54:57 -04:00
devicetree devicetree: spi: fix typo in docstring 2020-08-20 19:40:03 -04:00
dfu dfu: img_util: Add flash integrity check 2020-09-03 17:56:02 +02:00
disk device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
display device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
drivers drivers: timer: nrf: Add configurable clock startup mode 2020-09-10 21:31:01 +02:00
dt-bindings drivers: display: ili9340: add support for configuring pixel format 2020-09-29 14:18:05 -05:00
fs doc: update reference to use :c:macro 2020-09-15 15:25:01 +02:00
linker linker: do not force keep common kernel objects 2020-09-19 05:49:13 -04:00
logging logging: move _is_user_context() check down one level 2020-08-06 08:59:33 -04:00
mgmt mgmt/osdp: Refactor struct osdp_cmd members for readability 2020-09-04 10:58:13 +02:00
net net: mgmt: Clarify the net_mgmt API documentation 2020-09-30 16:31:38 +03:00
posix include/posix: incorporate toolchain-provided time.h header 2020-09-04 14:46:43 +02:00
power zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
random random: Add syscalls for random subsystem 2020-07-08 21:05:36 -04:00
settings settings: disallow modifying the content of a static subtree name 2020-07-27 19:03:44 +02:00
shell doc: update Kconfig options to use @option ALIAS 2020-09-15 15:25:01 +02:00
stats zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
storage include/storage/flash_map: describe return values of flash_area_open() 2020-09-24 19:21:48 +02:00
sys sys: byteorder: Fix incorrect shift in sys_get_be48/le48 2020-09-21 11:17:59 +02:00
timing timing: introduce timing functions as a generic feature 2020-09-05 13:28:38 -05:00
toolchain ARC: toolchain: handle difference in macros for MWDT and ARC GNU 2020-09-05 10:22:56 -05:00
tracing tracing: trace mutex/semaphore using dedicated calls 2020-08-24 13:21:12 +02:00
usb usb: hid: All hid_ops callbacks get device pointer. 2020-09-04 12:27:44 +02:00
zephyr zephyr: Use deprecated instead of legacy for Kconfig int types 2020-06-09 06:49:56 -05:00
cache.h syscalls: Add system call for cache flush & invalidate 2020-08-04 17:26:45 -04:00
device.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
devicetree.h devicetree: add accessors with default values 2020-08-04 07:35:26 -05:00
ec_host_cmd.h doc: reference: Add ec host command api hooks 2020-09-27 15:15:49 -05:00
emul.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
exc_handle.h
fatal.h
generated_dts_board.h dts: Add include/generated_dts_board.h for backwards compatibility 2020-01-17 17:57:59 +01:00
init.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
irq_nextlevel.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
irq_offload.h irq: Change offload API to take a constant parameter 2020-09-02 13:48:13 +02:00
irq.h irq: Change dynamic API to take a constant parameter 2020-09-02 13:48:13 +02:00
kernel_includes.h userspace: move mem domain defines 2020-08-20 13:58:54 -04:00
kernel_structs.h kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
kernel_version.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
kernel.h doc: Clarify semantics of k_msgq_put 2020-09-23 13:21:07 -05:00
mempool_heap.h sys_heap: reduce the size of struct z_heap_bucket by half 2020-06-21 19:25:35 +02:00
mempool_sys.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
ptp_clock.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
sched_priq.h
shared_irq.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
spinlock.h include: Add documentation for spinlocks 2020-05-08 10:46:44 +02:00
sw_isr_table.h irq: Change dynamic API to take a constant parameter 2020-09-02 13:48:13 +02:00
sys_clock.h api: Fix narrowing conversion C++ compilation warning in Z_TIMEOUT_TICKS 2020-06-30 12:21:41 -05:00
syscall_handler.h device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
syscall.h
timeout_q.h zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
toolchain.h ARC: toolchain: handle difference in macros for MWDT and ARC GNU 2020-09-05 10:22:56 -05:00
wait_q.h
zephyr.h