[PATCH][BZ #12140] Add note on free list pointers overwriting M_PERTURB bytes
Siddhesh Poyarekar
siddhesh@redhat.com
Wed Oct 17 13:41:00 GMT 2012
Hi,
M_PERTURB causes malloc and free to initialize the allocated (and
freed) memory block with a specified byte. A freed block however, will
not have the perturb pattern in all of the usable malloc area. This is
because the fd and bk pointers for the free list are within the usable
area due to which the initial portion of the usable area may get
overwritten.
In fact, as the reproducer in the bug report above shows, the initial
sizeof(void *) bytes will always be overwritten since p->fd is always
set during free of a block on heap.
Attached patch adds a note to the documentation mentioning this so that
someone debugging an application bug exposed by M_PERTURB does not get
confused trying to figure out why the initial part of the block does
not have the perturb pattern.
OK to commit?
Regards,
Siddhesh
ChangeLog:
[BZ #12140]
* manual/memory.texi (Malloc Tunable Parameters): Add note
about free list pointers overwriting some perturb bytes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: perturb.patch
Type: text/x-patch
Size: 678 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20121017/e4e4ffd3/attachment.bin>
More information about the Libc-alpha
mailing list