dlmalloc: use static magic constant for debug images 85/13785/1
authorFlorin Coras <fcoras@cisco.com>
Fri, 27 Jul 2018 18:30:46 +0000 (11:30 -0700)
committerFlorin Coras <fcoras@cisco.com>
Fri, 27 Jul 2018 18:39:14 +0000 (11:39 -0700)
Avoids crashes on restarts if svm root region backing file was not
cleaned up.

Change-Id: I608cf5711aa8c3f9620900473bdf76bde8b918de
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/vppinfra/dlmalloc.c
src/vppinfra/dlmalloc.h

index 2199d87..e5bd1e8 100644 (file)
@@ -1765,6 +1765,9 @@ static int init_mparams(void) {
 #endif
       magic |= (size_t)8U;    /* ensure nonzero */
       magic &= ~(size_t)7U;   /* improve chances of fault for bad values */
+#ifdef DLM_MAGIC_CONSTANT
+      magic = DLM_MAGIC_CONSTANT;
+#endif
       /* Until memory modes commonly available, use volatile-write */
       (*(volatile size_t *)(&(mparams.magic))) = magic;
     }
index b3278f9..b8e3236 100644 (file)
@@ -528,6 +528,7 @@ MAX_RELEASE_CHECK_RATE   default: 4095 unless not HAVE_MMAP
 
 #if CLIB_DEBUG > 0
 #define FOOTERS 1  /* extra debugging */
+#define DLM_MAGIC_CONSTANT 0xdeaddabe
 #endif
 #define USE_LOCKS 1
 #define DLM_ABORT {extern void os_panic(void); os_panic(); abort();}