curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Valgrind Reports Many Memory Errors on curl binary on Gentoo

From: John Helmert III via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 19 Feb 2019 16:01:15 -0600

On Tue, Feb 19, 2019 at 08:44:00AM +0100, Daniel Stenberg wrote:
> In an attempt to reproduce this, here's me on Linux 4.19, glibc 2.28, gcc
> 8.2.0, valgrind 3.14.0, openssl 1.1.1a on Debian unstable.

I suppose it's worth noting - I'm using valgrind 3.14 as well and openssl
1.0.2q

> Can you rerun configure with '--enable-debug' to get debug symbols on the
> library and then rerun the experiment to get more details on the backtrace for
> where exactly in the code valgrind finds the problems?

After reconfiguring wtih '--disabled-shared' and '--enable-debug', a lot of the
errors seem to be related to calls to nghttp2 (I'm using version 1.33.0) and
glibc, others within curl itself. Some examples:

$ valgrind --leak-check=full ./src/curl https://example.com
...
==19114== Conditional jump or move depends on uninitialised value(s)
==19114== at 0x18AE57: readwrite_data (transfer.c:870)
==19114== by 0x18BB7F: Curl_readwrite (transfer.c:1296)
==19114== by 0x145813: multi_runsingle (multi.c:1918)
==19114== by 0x1461A7: curl_multi_perform (multi.c:2205)
==19114== by 0x13D832: easy_transfer (easy.c:713)
==19114== by 0x13DAB1: easy_perform (easy.c:807)
==19114== by 0x13DB18: curl_easy_perform (easy.c:826)
==19114== by 0x130180: operate_do (tool_operate.c:1579)
==19114== by 0x1315D4: operate (tool_operate.c:2082)
==19114== by 0x129A4B: main (tool_main.c:326)
...
==19114== Use of uninitialised value of size 8
==19114== at 0x4E51D65: nghttp2_rcbuf_decref (in /usr/lib64/libnghttp2.so.14.17.0)
==19114== by 0x4E4D987: hd_ringbuf_free (in /usr/lib64/libnghttp2.so.14.17.0)
==19114== by 0x4E44529: nghttp2_session_del (in /usr/lib64/libnghttp2.so.14.17.0)
==19114== by 0x14FF9B: http2_disconnect (http2.c:167)
==19114== by 0x17C846: Curl_disconnect (url.c:789)
==19114== by 0x14F285: Curl_conncache_close_all_connections (conncache.c:577)
==19114== by 0x1463E5: curl_multi_cleanup (multi.c:2278)
==19114== by 0x17B56F: Curl_close (url.c:337)
==19114== by 0x13DB8C: curl_easy_cleanup (easy.c:853)
==19114== by 0x129970: main_free (tool_main.c:217)
==19114== by 0x129A5A: main (tool_main.c:334)
==19114==
==19114==
==19114== HEAP SUMMARY:
==19114== in use at exit: 1,696 bytes in 50 blocks
==19114== total heap usage: 32,216 allocs, 32,166 frees, 3,051,031 bytes allocated
==19114==
==19114== LEAK SUMMARY:
==19114== definitely lost: 0 bytes in 0 blocks
==19114== indirectly lost: 0 bytes in 0 blocks
==19114== possibly lost: 0 bytes in 0 blocks
==19114== still reachable: 1,696 bytes in 50 blocks
==19114== suppressed: 0 bytes in 0 blocks
==19114== Reachable blocks (those to which a pointer was found) are not shown.
==19114== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==19114==
==19114== For counts of detected and suppressed errors, rerun with: -v
==19114== Use --track-origins=yes to see where uninitialised values come from
==19114== ERROR SUMMARY: 2493 errors from 396 contexts (suppressed: 0 from 0)

Re-configuring/re-compiling with '--without-nghttp2', nghttp2 errors are
unsurprisingly absent from the valgrind output, but I'm still getting a lot
of errors and the same leak summary:

==3070== HEAP SUMMARY:
==3070== in use at exit: 1,696 bytes in 50 blocks
==3070== total heap usage: 32,155 allocs, 32,105 frees, 2,823,956 bytes allocated
==3070==
==3070== LEAK SUMMARY:
==3070== definitely lost: 0 bytes in 0 blocks
==3070== indirectly lost: 0 bytes in 0 blocks
==3070== possibly lost: 0 bytes in 0 blocks
==3070== still reachable: 1,696 bytes in 50 blocks
==3070== suppressed: 0 bytes in 0 blocks
==3070== Reachable blocks (those to which a pointer was found) are not shown.
==3070== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3070==
==3070== For counts of detected and suppressed errors, rerun with: -v
==3070== Use --track-origins=yes to see where uninitialised values come from
==3070== ERROR SUMMARY: 5704 errors from 322 contexts (suppressed: 0 from 0)

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2019-02-19