diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-09-23 16:34:23 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-09-23 16:34:23 +0000 |
commit | 3b93a2dee1e2b50f47919c49ca3fd28e565e085d (patch) | |
tree | 2c5ee3ebe17408bd7530b7bacee429f53c2df50e /c/src/exec/libcsupport/src | |
parent | changed version to 980923 (diff) | |
download | rtems-3b93a2dee1e2b50f47919c49ca3fd28e565e085d.tar.bz2 |
Modifed to zero out the C heap if the CPU Table indicates that the
RTEMS workspace is to be zeroed out.
Diffstat (limited to 'c/src/exec/libcsupport/src')
-rw-r--r-- | c/src/exec/libcsupport/src/malloc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/c/src/exec/libcsupport/src/malloc.c b/c/src/exec/libcsupport/src/malloc.c index 7973093545..db408ec050 100644 --- a/c/src/exec/libcsupport/src/malloc.c +++ b/c/src/exec/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. |