bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in setting initial brk?


From: John Reiser
Subject: Re: bug in setting initial brk?
Date: Sun, 27 May 2001 19:48:00 -0700

> The code in sysdeps/unix/sysv/linux/dl-sysdep.c:39
> 
>     __sbrk (_dl_pagesize - ((&_end - (void *) 0) & _dl_pagesize));
> 
> does not match the corresponding elf/dl-minimal.c:63
> 
>       alloc_end = (void *) 0 + (((alloc_ptr - (void *) 0) + _dl_pagesize - 1)
>                                 & ~(_dl_pagesize - 1));

Any user-visible wrong ansers are prevented by
sysdeps/generic/dl-sysdep.c:199

    __sbrk (_dl_pagesize - ((&_end - (void *) 0) & (_dl_pagesize - 1)));

which uses a correct formula, and recovers the case when _end is on
an odd-numbered page.  So the linux specialization of this part
of DL_SYSDEP_INIT is "just" a lucky misstep and bloat.

-- 
John Reiser, address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]