diff options
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libcsupport/src/malloc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c index 7973093545..db408ec050 100644 --- a/cpukit/libcsupport/src/malloc.c +++ b/cpukit/libcsupport/src/malloc.c @@ -36,6 +36,7 @@ rtems_id RTEMS_Malloc_Heap; size_t RTEMS_Malloc_Sbrk_amount; +extern rtems_cpu_table Cpu_table; #ifdef RTEMS_DEBUG #define MALLOC_STATS #define MALLOC_DIRTY @@ -102,6 +103,20 @@ void RTEMS_Malloc_Initialize( } /* + * If the BSP is not clearing out the workspace, then it is most likely + * not clearing out the initial memory for the heap. There is no + * standard supporting zeroing out the heap memory. But much code + * with UNIX history seems to assume that memory malloc'ed during + * initialization (before any free's) is zero'ed. This is true most + * of the time under UNIX because zero'ing memory when it is first + * given to a process eliminates the chance of a process seeing data + * left over from another process. This would be a security violation. + */ + + if ( Cpu_table.do_zero_of_workspace ) + memset( starting_address, 0, length ); + + /* * Unfortunately we cannot use assert if this fails because if this * has failed we do not have a heap and if we do not have a heap * STDIO cannot work because there will be no buffers. |