[uClibc] Patch to malloc-standard

Peter S. Mazinger ps.m at gmx.net
Fri Jan 30 22:33:03 UTC 2004


On Fri, 30 Jan 2004, Erik Andersen wrote:

> On Thu Jan 29, 2004 at 07:19:52PM +0100, Peter S. Mazinger wrote:
> > 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.
> 
> Not sure if you noticed, but there is no "abort-instr.h" header.
> It makes a lot more sense to just call abort() directly here
> anyways rather than trying to reimplement a local mini-abort().

Well, I didn't thought of applying it directly, I have found the 
ABORT_* defines in abort.c and my thought was to move them into an 
include file.

Due to the fact that malloc-standard and malloc in glibc-2 do have the 
same roots, and what solar designer applies is mostly security/sanity 
related stuff, I only proposed to apply if you want to. I do not really 
understand the code myself, so I can't comment if it is really needed or 
not.

> 
> Something like this seems more sensible:
> 
> --- uClibc/libc/stdlib/malloc-standard/malloc.h	30 Dec 2003 10:40:49 -0000	1.1
> +++ uClibc/libc/stdlib/malloc-standard/malloc.h	30 Jan 2004 21:54:22 -0000
> @@ -20,6 +20,7 @@
>  #include <errno.h>
>  #include <string.h>
>  #include <malloc.h>
> +#include <stdlib.h>
>  
>  
>  #ifdef __UCLIBC_HAS_THREADS__
> @@ -636,6 +637,8 @@
>  #define unlink(P, BK, FD) {                                            \
>    FD = P->fd;                                                          \
>    BK = P->bk;                                                          \
> +  if (FD->bk != P || BK->fd != P)                                      \
> +      abort();                                                         \

if this achieves the same (hlt,abort,etc) independently of the arch, ok.

Peter

>    FD->bk = BK;                                                         \
>    BK->fd = FD;                                                         \
>  }
> 
>  -Erik
> 
> --
> Erik B. Andersen             http://codepoet-consulting.com/
> --This message was written using 73% post-consumer electrons--
> 
> 
> 

-- 
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



More information about the uClibc mailing list