[FS#3392] valgrind: does not detect obvious memory leak

OpenWrt Bugs openwrt-bugs at lists.openwrt.org
Mon Oct 19 05:59:57 EDT 2020


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#3392 - valgrind: does not detect obvious memory leak
User who did this - Jo-Philipp Wich (jow-)

----------
Works for me:

BusyBox v1.31.1 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r14601-8b4233188d
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root at OpenWrt:/# valgrind /tmp/test
==2866== Memcheck, a memory error detector
==2866== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2866== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2866== Command: /tmp/test
==2866== 
==2866== Conditional jump or move depends on uninitialised value(s)
==2866==    at 0x401961F: stpcpy (stpcpy.c:20)
==2866==    by 0x4019A18: strcpy (strcpy.c:5)
==2866==    by 0x405AC3B: load_library (dynlink.c:1133)
==2866==    by 0x405AE9F: load_direct_deps (dynlink.c:1192)
==2866==    by 0x405AE9F: load_deps (dynlink.c:1209)
==2866==    by 0x405AE9F: load_deps (dynlink.c:1205)
==2866==    by 0x405B826: __dls3 (dynlink.c:1845)
==2866==    by 0x405B175: __dls2 (dynlink.c:1650)
==2866==    by 0x4058D17: ??? (in /lib/libc.so)
==2866== 
==2866== 
==2866== HEAP SUMMARY:
==2866==     in use at exit: 1,903 bytes in 7 blocks
==2866==   total heap usage: 8 allocs, 1 frees, 1,951 bytes allocated
==2866== 
==2866== LEAK SUMMARY:
==2866==    definitely lost: 1,024 bytes in 1 blocks
==2866==    indirectly lost: 0 bytes in 0 blocks
==2866==      possibly lost: 0 bytes in 0 blocks
==2866==    still reachable: 879 bytes in 6 blocks
==2866==         suppressed: 0 bytes in 0 blocks
==2866== Rerun with --leak-check=full to see details of leaked memory
==2866== 
==2866== Use --track-origins=yes to see where uninitialised values come from
==2866== For lists of detected and suppressed errors, rerun with: -s
==2866== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
root at OpenWrt:/# 



In order for valgrind to be able to wrap malloc/free etc, you need an unstripped musl libc. To avoid doing a new build you could scp the unstripped libc.so to your target and execute it directly:


jow at j7:~/devel/lede/staging.git$ scp build_dir/toolchain-x86_64_gcc-8.4.0_musl/musl-1.1.24/lib/libc.so root at 192.168.1.1:/tmp/
Warning: Permanently added '192.168.1.1' (ED25519) to the list of known hosts.
libc.so                                                                                                        100% 3811KB   9.8MB/s   00:00    
jow at j7:~/devel/lede/staging.git$ ssh root at 192.168.1.1
Warning: Permanently added '192.168.1.1' (ED25519) to the list of known hosts.


BusyBox v1.31.1 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r14601-8b4233188d
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root at OpenWrt:~# valgrind /tmp/test
==2884== Memcheck, a memory error detector
==2884== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2884== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2884== Command: /tmp/test
==2884== 
==2884== Conditional jump or move depends on uninitialised value(s)
==2884==    at 0x121DDC: ??? (in /lib/libc.so)
==2884==    by 0x162E9F: ??? (in /lib/libc.so)
==2884== 
==2884== Conditional jump or move depends on uninitialised value(s)
==2884==    at 0x12161F: ??? (in /lib/libc.so)
==2884==    by 0x162E9F: ??? (in /lib/libc.so)
==2884== 
==2884== 
==2884== HEAP SUMMARY:
==2884==     in use at exit: 0 bytes in 0 blocks
==2884==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==2884== 
==2884== All heap blocks were freed -- no leaks are possible
==2884== 
==2884== Use --track-origins=yes to see where uninitialised values come from
==2884== For lists of detected and suppressed errors, rerun with: -s
==2884== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
root at OpenWrt:~# valgrind /tmp/libc.so /tmp/test
==2885== Memcheck, a memory error detector
==2885== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2885== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2885== Command: /tmp/libc.so /tmp/test
==2885== 
==2885== Conditional jump or move depends on uninitialised value(s)
==2885==    at 0x12161F: stpcpy (stpcpy.c:20)
==2885==    by 0x121A18: strcpy (strcpy.c:5)
==2885==    by 0x162C3B: load_library (dynlink.c:1133)
==2885==    by 0x162E9F: load_direct_deps (dynlink.c:1192)
==2885==    by 0x162E9F: load_deps (dynlink.c:1209)
==2885==    by 0x162E9F: load_deps (dynlink.c:1205)
==2885==    by 0x163826: __dls3 (dynlink.c:1845)
==2885==    by 0x163175: __dls2 (dynlink.c:1650)
==2885==    by 0x160D17: ??? (in /tmp/libc.so)
==2885==    by 0x1: ???
==2885== 
==2885== 
==2885== HEAP SUMMARY:
==2885==     in use at exit: 1,903 bytes in 7 blocks
==2885==   total heap usage: 8 allocs, 1 frees, 1,951 bytes allocated
==2885== 
==2885== LEAK SUMMARY:
==2885==    definitely lost: 1,024 bytes in 1 blocks
==2885==    indirectly lost: 0 bytes in 0 blocks
==2885==      possibly lost: 0 bytes in 0 blocks
==2885==    still reachable: 879 bytes in 6 blocks
==2885==         suppressed: 0 bytes in 0 blocks
==2885== Rerun with --leak-check=full to see details of leaked memory
==2885== 
==2885== Use --track-origins=yes to see where uninitialised values come from
==2885== For lists of detected and suppressed errors, rerun with: -s
==2885== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
root at OpenWrt:~#

----------

More information can be found at the following URL:
https://bugs.openwrt.org/index.php?do=details&task_id=3392#comment8912

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.



More information about the openwrt-bugs mailing list