[uClibc] Patch to malloc-standard

Peter S. Mazinger ps.m at gmx.net
Thu Jan 29 11:19:52 MST 2004


Hello!

Gentoo applies the attached (OWL/openwall) patch to glibc's malloc. I have 
checked malloc-standard/malloc.h (not malloc.c), it would apply there.

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2

____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
-------------- next part --------------
--- malloc/malloc.c.orig	2004-01-03 18:36:23.000000000 -0500
+++ malloc/malloc.c	2004-01-03 18:46:16.000000000 -0500
@@ -311,6 +311,11 @@ extern "C" {
 #define assert(x) ((void)0)
 #endif
 
+/* needed for owl-malloc-unlink-sanity-check */
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+#define ABORT_INSTRUCTION
+#endif
 
 /*
   INTERNAL_SIZE_T is the word-size used for internal bookkeeping
@@ -1951,6 +1956,14 @@ typedef struct malloc_chunk* mbinptr;
 #define unlink(P, BK, FD) {                                            \
   FD = P->fd;                                                          \
   BK = P->bk;                                                          \
+  /* owl-malloc-unlink-sanity-check */                                 \
+  if (FD->bk != P || BK->fd != P)                                      \
+  {                                                                    \
+    ABORT_INSTRUCTION;                                                 \
+    _exit(127);                                                        \
+    while (1)                                                          \
+      ABORT_INSTRUCTION;                                               \
+  }                                                                    \
   FD->bk = BK;                                                         \
   BK->fd = FD;                                                         \
 }


More information about the uClibc mailing list