Changeset de9b7d7 in rtems for testsuites


Ignore:
Timestamp:
Jun 1, 2018, 5:04:45 AM (19 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
07c5976
Parents:
c934365f
git-author:
Sebastian Huber <sebastian.huber@…> (06/01/18 05:04:45)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/05/18 06:49:56)
Message:

Add RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE

An invalid heap usage such as a double free is usually a fatal error
since this indicates a use after free. Replace the use of printk() in
free() with a fatal error.

Update #3437.

Location:
testsuites
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/malloc03/init.c

    rc934365f rde9b7d7  
    1313
    1414#include <tmacros.h>
    15 #include "test_support.h"
    1615
    1716const char rtems_test_name[] = "MALLOC 3";
    1817
    19 /* forward declarations to avoid warnings */
    20 rtems_task Init(rtems_task_argument argument);
    21 
    22 rtems_task Init(
     18static rtems_task Init(
    2319  rtems_task_argument argument
    2420)
     
    3127  printf("Attempt to free stack memory\n");
    3228  free( p1 );
     29}
    3330
    34   TEST_END();
    35 
    36   rtems_test_exit(0);
     31static void fatal_extension(
     32  rtems_fatal_source source,
     33  bool always_set_to_false,
     34  rtems_fatal_code error
     35)
     36{
     37  if (
     38    source == RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE
     39      && !always_set_to_false
     40      && error != 0
     41  ) {
     42    TEST_END();
     43  }
    3744}
    3845
     
    4350
    4451#define CONFIGURE_MAXIMUM_TASKS             1
    45 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
     52
     53#define CONFIGURE_INITIAL_EXTENSIONS \
     54  { .fatal = fatal_extension }, \
     55  RTEMS_TEST_INITIAL_EXTENSION
    4656
    4757#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
  • testsuites/sptests/Makefile.am

    rc934365f rde9b7d7  
    10991099endif
    11001100
     1101if TEST_spfatal32
     1102sp_tests += spfatal32
     1103sp_screens += spfatal32/spfatal32.scn
     1104sp_docs += spfatal32/spfatal32.doc
     1105spfatal32_SOURCES = spfatal_support/init.c spfatal_support/system.h \
     1106        spfatal32/testcase.h
     1107spfatal32_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal32) \
     1108        $(support_includes) -I$(top_srcdir)/spfatal32
     1109endif
     1110
    11011111if TEST_spfifo01
    11021112sp_tests += spfifo01
  • testsuites/sptests/configure.ac

    rc934365f rde9b7d7  
    158158RTEMS_TEST_CHECK([spfatal30])
    159159RTEMS_TEST_CHECK([spfatal31])
     160RTEMS_TEST_CHECK([spfatal32])
    160161RTEMS_TEST_CHECK([spfifo01])
    161162RTEMS_TEST_CHECK([spfifo02])
  • testsuites/sptests/spinternalerror02/init.c

    rc934365f rde9b7d7  
    5454  } while ( text != text_last );
    5555
    56   rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_PANIC );
     56  rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE );
    5757}
    5858
  • testsuites/sptests/spinternalerror02/spinternalerror02.scn

    rc934365f rde9b7d7  
    4646RTEMS_FATAL_SOURCE_SMP
    4747RTEMS_FATAL_SOURCE_PANIC
     48RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE
    4849?
    4950?
Note: See TracChangeset for help on using the changeset viewer.