#1814 closed defect (fixed)

SMP race condition between stack free and dispatch

Reported by: Marta Rybczynska Owned by: Joel Sherrill
Priority: normal Milestone: 4.11
Component: score Version: 4.11
Severity: normal Keywords:
Cc: jennifer.averett@…, sebastian.huber@…, gedare@…, fred@…, fournel.nicolas@… Blocked By:
Blocking:

Description

The thread stack is free'd in _Thread_Close. Then it still uses this stack before being de-scheduled in _Thread_Dispatch. However, the allocation is protected by allocator lock, not by the dispatch lock, so in SMP another processor may grab the already-used-but-freed stack.

The attached patch delays the stack deallocation to Thread_Dispatch. It is done if the thread we switched from has been removed.

This version depends on #1731, but we can easily provide a separate one.

Attachments (1)

thread_exit.patch (2.7 KB) - added by Marta Rybczynska on Jun 14, 2011 at 7:35:46 AM.
Thread exit/stack deallocation patch

Download all attachments as: .zip

Change History (6)

Changed on Jun 14, 2011 at 7:35:46 AM by Marta Rybczynska

Attachment: thread_exit.patch added

Thread exit/stack deallocation patch

comment:1 Changed on Jun 15, 2011 at 3:04:55 PM by Gedare Bloom

Cc: giddyup44@… added

comment:2 Changed on Jun 15, 2011 at 3:17:34 PM by Joel Sherrill

Cc: Sebastian Huber added

comment:3 Changed on Jun 15, 2011 at 6:02:33 PM by Joel Sherrill

Cc: Jennifer Averett added

comment:5 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

Note: See TracTickets for help on using tickets.