Changeset d134adeb in rtems


Ignore:
Timestamp:
May 23, 2014, 1:32:32 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
97d0b9b
Parents:
b3fb2ff
git-author:
Sebastian Huber <sebastian.huber@…> (05/23/14 13:32:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/26/14 06:56:44)
Message:

score: Fix race condition in SMP startup

Do not use the Per_CPU_Control::started in
_SMP_Start_multitasking_on_secondary_processor() since this field may be
not up to date when a secondary processor reads it. Use the read-only
scheduler assignment instead.

Add a new fatal error SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR.
This prevents out-of-bounds access.

It is currently not possible to test these fatal errors. One option
would be to fake values of the _CPU_SMP_Get_current_processor(), but
unfortunately this function is inline on some architectures.

Files:
4 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/smpimpl.h

    rb3fb2ff rd134adeb  
    6161  SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR,
    6262  SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED,
    63   SMP_FATAL_SHUTDOWN_RESPONSE
     63  SMP_FATAL_SHUTDOWN_RESPONSE,
     64  SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR
    6465} SMP_Fatal_code;
    6566
  • cpukit/score/src/smp.c

    rb3fb2ff rd134adeb  
    122122{
    123123  Per_CPU_Control *self_cpu = _Per_CPU_Get();
     124  uint32_t cpu_index_self = _Per_CPU_Get_index( self_cpu );
     125  const Scheduler_Assignment *assignment =
     126    _Scheduler_Get_assignment( cpu_index_self );
    124127
    125   if ( !_Per_CPU_Is_processor_started( self_cpu ) ) {
     128  if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) {
     129    _SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR );
     130  }
     131
     132  if ( !_Scheduler_Should_start_processor( assignment ) ) {
    126133    _SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR );
    127134  }
  • testsuites/smptests/Makefile.am

    rb3fb2ff rd134adeb  
    1717SUBDIRS += smpfatal04
    1818SUBDIRS += smpfatal05
    19 SUBDIRS += smpfatal07
    2019SUBDIRS += smpfatal08
    2120SUBDIRS += smpipi01
  • testsuites/smptests/configure.ac

    rb3fb2ff rd134adeb  
    7272smpfatal04/Makefile
    7373smpfatal05/Makefile
    74 smpfatal07/Makefile
    7574smpfatal08/Makefile
    7675smpipi01/Makefile
Note: See TracChangeset for help on using the changeset viewer.