[riot-notifications] [RIOT-OS/RIOT] cpu/native: fix race in thread_yield_higher() [backport 2019.01] (#10921)

Martine Lenders notifications at github.com
Fri Feb 1 16:23:50 CET 2019

# Backport of #10891

### Contribution description

    Error case:
    1. thread_yield_higher() stores the thread's ucontext
    2. creates an "isr ucontext" for isr_thread_yield, switches to it
    Case 1: no signals are pending, continues in isr_thread_yield()
    3a. sched_run is called
    4a. return to sched_active_thread ucontext
    Case 2: signals pending (the crashing scenario), continues in native_irq_handler()
    3b. handles signals
    4b. if sched_context_switch_request is set, call sched_run
    5b. return to sched_active_thread ucontext
    4b misses the call to sched_run(), leading to a possible return into a
    non-ready thread.

Fixes #10881.

### Testing procedure

See #10881 and #10908

### Issues/PRs references

Fixes #10881.
Fixes #6123.
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * cpu/native: fix race condition in thread_yield_higher()
  * core/msg: add assert for problem identified in #10881

-- File Changes --

    M core/msg.c (1)
    M cpu/native/native_cpu.c (5)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190201/16e1253e/attachment.html>

More information about the notifications mailing list