Bug#177242: libc6: MALLOC_CHECK_ broken on hppa?
> I'll look into this today, I'm just rebuilding libc with my own version
> of hooks for malloc so I can take a closer look at the exact failure. I
> see it's not making it past some of the initial checks in
> mem2chunk_check which could really mean a lot of different things.
/* Check if m has acceptable alignment */
#define aligned_OK(m) (((unsigned long)((m)) & (MALLOC_ALIGN_MASK)) == 0)
HPPA has MALLOC_ALIGNMENT set to 16, which means that MALLOC_ALIGN_MASK
is (16-1), 15, and thus:
aligned_OK(m) returns 1 if the alignment is 0x?????0.
aligned_OK(m) returns 0 if the alignment is 0x?????A where A!=0.
The check code looks good:
if(!aligned_OK(p)) return NULL;
And the addresses that fail look like this:
carlos@firin:~$ MALLOC_CHECK_=1 ./mtest
malloc: using debugging hooks
free(): invalid pointer 0x21010!
That address _is_ aligned, yet it doesn't pass the aligned_OK check, or it
would have printed "aligned_OK passed." I'm rebuilding with some more
checks in place.