zephyr/kernel/include
Andy Ross d8d5ec3f91 kernel: Fix double-list-removal corruption case in timeout handling
This fixes #8669, and is distressingly subtle for a one-line patch:

The list iteration code in _handle_expired_timeouts() would remove the
timeout from our (temporary -- the dlist header is on the stack of our
calling function) list of expired timeouts before invoking the
handler.  But sys_dlist_remove() only fixes up the containing list
pointers, leaving garbage in the node.  If the action of that handler
is to re-add the timeout (which is very common!) then that will then
try to remove it AGAIN from the same list.

Even then, the common case is that the expired list contains only one
item, so the result is a perfectly valid empty list that affects
nothing.  But if you have more than one, you get a corrupt cycle in
the iteration list and things get weird.

As it happens, there's no value in trying to remove this timeout from
the temporary list at all.  Just iterate over it naturally.

Really, this design is fragile: we shouldn't be reusing the list nodes
in struct _timeout for this purpose and should figure out some other
mechanism.  But this fix should be good for now.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-08-26 19:39:52 -07:00
..
gen_offset.h
kernel_internal.h kernel: add z_arch_user_string_nlen prototype 2018-07-31 07:47:15 -07:00
kernel_offsets.h cmake: Deprecate the 2 symbols _SYSCALL_{LIMIT,BAD} 2018-08-15 11:46:51 -07:00
kernel_structs.h kernel: Fix bitwise operators with unsigned operators 2018-08-16 19:47:41 -07:00
ksched.h kernel: event_logger: remove kernel_event_logger 2018-08-21 05:45:47 -07:00
kswap.h systemview: add support natively using tracing hooks 2018-08-21 05:45:47 -07:00
offsets_short.h
syscall_handler.h userspace: add _k_object_recycle() 2018-08-13 07:19:39 -07:00
timeout_q.h kernel: Fix double-list-removal corruption case in timeout handling 2018-08-26 19:39:52 -07:00
wait_q.h kernel/Kconfig: Reorgnize wait_q and sched algorithm choices 2018-07-03 17:09:15 -04:00