#2130 closed defect (fixed)

Race condition in nanosleep()

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: low Milestone: 4.11
Component: score Version: 4.11
Severity: critical Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

int nanosleep(

const struct timespec *rqtp,
struct timespec *rmtp

)
{
[...]

/*

  • Block for the desired amount of time */

_Thread_Disable_dispatch();

executing = _Thread_Executing;
_Thread_Set_state(

executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL

);

<-- A signal at this point will destroy the watchdog chain and the system is corrupt.

_Watchdog_Initialize(

&executing->Timer,
_Thread_Delay_ended,
executing->Object.id,
NULL

);
_Watchdog_Insert_ticks( &executing->Timer, ticks );

_Thread_Enable_dispatch();

[...]

Change History (7)

comment:1 Changed on 07/22/13 at 12:01:39 by Sebastian Huber

int nanosleep(

const struct timespec *rqtp,
struct timespec *rmtp

)
{
[...]

/*

  • Block for the desired amount of time */

_Thread_Disable_dispatch();

executing = _Thread_Executing;
_Thread_Set_state(

executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL

);

<-- A signal at this point will destroy the watchdog chain and the system is corrupt.

_Watchdog_Initialize(

&executing->Timer,
_Thread_Delay_ended,
executing->Object.id,
NULL

);
_Watchdog_Insert_ticks( &executing->Timer, ticks );

_Thread_Enable_dispatch();

[...]

comment:2 Changed on 11/24/14 at 18:58:28 by Gedare Bloom

Version: HEAD4.11

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

comment:3 Changed on 12/18/14 at 12:28:21 by Sebastian Huber

Description: modified (diff)
Milestone: 4.115.0
Priority: normallow
Severity: normalcritical

comment:4 Changed on 03/20/15 at 09:03:14 by Sebastian Huber

This problem can be fixed using the new Thread_Control::Wait::flags. Se also the RTEMS event implementation.

comment:5 Changed on 05/16/15 at 09:30:05 by Sebastian Huber

Milestone: 5.04.11

comment:6 Changed on 05/16/15 at 09:39:15 by Sebastian Huber

Owner: changed from Joel Sherrill to Sebastian Huber
Status: newaccepted

comment:7 Changed on 05/20/15 at 07:27:25 by Sebastian Huber

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.