#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 Jul 22, 2013 at 12:01:39 PM 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 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

comment:3 Changed on Dec 18, 2014 at 12:28:21 PM by Sebastian Huber

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

comment:4 Changed on Mar 20, 2015 at 9:03:14 AM 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 May 16, 2015 at 9:30:05 AM by Sebastian Huber

Milestone: 5.04.11

comment:6 Changed on May 16, 2015 at 9:39:15 AM by Sebastian Huber

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

comment:7 Changed on May 20, 2015 at 7:27:25 AM by Sebastian Huber

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