]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
In realloc(9), determine size of the original block based on
authorPawel Jakub Dawidek <pjd@FreeBSD.org>
Wed, 28 Dec 2005 01:53:13 +0000 (01:53 +0000)
committerPawel Jakub Dawidek <pjd@FreeBSD.org>
Wed, 28 Dec 2005 01:53:13 +0000 (01:53 +0000)
commit619f284195fdc856a4dfae7cc0cdeedd19a9e980
treee63254f2504d3f0195d7bf50a02a78244ac2d94a
parent333051eeb3aab27ae3990ec2abe33f4f0d7f832d
In realloc(9), determine size of the original block based on
UMA_SLAB_MALLOC flag.
In some circumstances (I observed it when I was doing a lot of reallocs)
UMA_SLAB_MALLOC can be set even if us_keg != NULL.

If this is the case we have wonderful, silent data corruption, because less
data is copied to the newly allocated region than should be.

I'm not sure when this bug was introduced, it could be there undetected
for years now, as we don't have a lot of realloc(9) consumers and it was
hard to reproduce it...
...but what I know for sure, is that I don't want to know who introduce
the bug:) It took me two/three days to track it down (of course most of
the time I was looking for the bug in my own code).
sys/kern/kern_malloc.c