|
Message-ID: <1371396379.5692.96.camel@eris.loria.fr>
Date: Sun, 16 Jun 2013 17:26:19 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: valgrind problems
Hello,
Am Sonntag, den 16.06.2013, 10:31 -0400 schrieb Rich Felker:
> Is there no way to make the suppression more fine-grained? For
> example, "ignore up to wordsize-1 sequential invalid reads in this
> function" would give the desired behavior. glibc has some sort of
> suppression for these functions; what does valgrind do for glibc?
I think it basically wraps its own code around some functions. Or
maybe just replaces them?
Such an approach obviously doesn't work if we link the C library
statically. I just wanted to try to link statically against glibc to
see what happens, but got stuck with other stuff.
> > Also for calloc I am not sure that when we switch off the false
> > positive (where musl assumes a certain gcc behavior for what in
> > general is UB)
>
> musl is not assuming any gcc behavior.
unfortunately it does. as an optimization shortcut it reads the newly
allocated bytes and if they are already 0, it doesn't write to
them. So this uses the fact that the newly allocated memory has an
unspecified, but determined value to do some optimization.
It is exactly that line of calloc.c, namely the `if` in line 20 that
triggers under valgrind.
In a recent discussion with the C committee I have learned that there
is no consensus of whether an unspecified value is determined and
wouldn't change once it is observed or whether it could be "wobbling"
(the term that someone used, there). There are even people that
propose to have a sort of state outside the object representation that
captures if memory has been initialized or not.
Jens
--
:: INRIA Nancy Grand Est :: http://www.loria.fr/~gustedt/ ::
:: AlGorille ::::::::::::::: office Nancy : +33 383593090 ::
:: ICube :::::::::::::: office Strasbourg : +33 368854536 ::
:: ::::::::::::::::::::::::::: gsm France : +33 651400183 ::
:: :::::::::::::::::::: gsm international : +49 15737185122 ::
Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.