This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 7/7] malloc: Check the alignment of mmapped chunks before unmapping.


I +1'd this patch series last year when it was first posted (sorry about
the lack of consensus-building) but just to revive it I'll +1 it again
independently.  Could we get a second review too?  Florian?

Reviewed-Again-By: DJ Delorie <dj@redhat.com>

Istvan Kurucsai <pistukem@gmail.com> writes:
> +  size_t pagesize = GLRO (dl_pagesize);

pagesize is used multiple times, so save the overhead.  OK.

> +  uintptr_t mem = (uintptr_t) chunk2mem(p);

This is the pointer the application sees.  OK

> -  if (__builtin_expect (((block | total_size) & (GLRO (dl_pagesize) - 1)) != 0, 0))
> +  if (__glibc_unlikely ((block | total_size) & (pagesize - 1)) != 0
> +      || __glibc_unlikely (!powerof2 (mem & (pagesize - 1))))

This adds a test for "is the pointer the application saw, some
unexpected offset into the page?".  OK.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]