[nos-bbs] JNOS 2.0k memory issue 2: valgrind

Michael Fox - N6MEF n6mef at mefox.org
Mon Aug 15 13:53:25 EDT 2016


 

Memory Issue 2:  valgrind reports an enormous number of errors.

 

At Bob Tenty's suggestion, I tried running JNOS 2.0k under valgrind to see
if there were any memory leaks.  The command used was:

 

    valgrind  --test=memcheck  --leak-check=yes  --log-file=valgrind.log
./jnos.exe -d /opt/jnos

 

Valgrind stops reporting after 1000 (default cutoff) errors.  The resulting
log file is 13,312 lines long.  I included some sample entries below to show
the types of conditions it reported.  Skip to the end to read the summary.

 

Note that the compiler also gives some warnings about uninitialized values.


 

I don't know how valuable or accurate this tool is.   But I did try it.  So
I'm reporting the results.

 

Michael

N6MEF

 

 

Valgrind.log:

 

==6792== Memcheck, a memory error detector

==6792== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.

==6792== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info

==6792== Command: ./jnos.exe -d /opt/jnos

==6792== Parent PID: 6779

==6792== 

==6792== Syscall param rt_sigaction(act->sa_mask) points to uninitialised
byte(s)

==6792==    at 0x58CEDBD: __libc_sigaction (sigaction.c:64)

==6792==    by 0x4803D4: init_sys (unix.c:739)

==6792==    by 0x4A6A8B: ioinit (sessmgr.c:677)

==6792==    by 0x4040B8: main (main.c:553)

==6792==  Address 0xfff0002d8 is on thread 1's stack

 

[clipped]

 

==6792== Invalid read of size 8

==6792==    at 0x58DF4DA: swapcontext (swapcontext.S:108)

==6792==    by 0x45613A: stkutil (ksubr.c:127)

==6792==    by 0x58E17FF: ??? (in /lib/x86_64-linux-gnu/libc-2.19.so)

==6792==  Address 0x5e98d18 is 168 bytes inside a block of size 1,104
alloc'd

==6792==    at 0x4C2AC3D: malloc (vg_replace_malloc.c:299)

==6792==    by 0x47F9B4: mallocw (unix.c:255)

==6792==    by 0x47F9F0: callocw (unix.c:269)

==6792==    by 0x4555DC: newproc (kernel.c:79)

==6792==    by 0x40422C: main (main.c:620)

 

[clipped]

 

==6792== Conditional jump or move depends on uninitialised value(s)

==6792==    at 0x453E05: pullup (mbuf.c:408)

==6792==    by 0x4541EB: pullchar (mbuf.c:589)

==6792==    by 0x44CA85: rrecvchar (sockuser.c:648)

==6792==    by 0x4A72E3: rflush (sessmgr.c:936)

==6792==    by 0x47FF6A: ding (unix.c:626)

==6792==    by 0x48047B: giveup (unix.c:773)

==6792==    by 0x455AA1: pwait (kernel.c:325)

==6792==    by 0x452310: timerproc (timer.c:37)

==6792==    by 0x456164: _kicker (ksubr.c:142)

==6792==    by 0x58E17FF: ??? (in /lib/x86_64-linux-gnu/libc-2.19.so)

 

[clipped]

 

==6792== Use of uninitialised value of size 8

==6792==    at 0x455D14: delproc (kernel.c:469)

==6792==    by 0x4559DF: alert (kernel.c:268)

==6792==    by 0x452726: t_alarm (timer.c:223)

==6792==    by 0x4523A0: timerproc (timer.c:59)

==6792==    by 0x456164: _kicker (ksubr.c:142)

==6792==    by 0x58E17FF: ??? (in /lib/x86_64-linux-gnu/libc-2.19.so)

 

[clipped]

 

==6792== Syscall param rt_sigprocmask(set) points to uninitialised byte(s)

==6792==    at 0x58DF48A: swapcontext (swapcontext.S:79)

==6792==    by 0x455B05: pwait (kernel.c:348)

==6792==    by 0x4523CC: timerproc (timer.c:61)

==6792==    by 0x456164: _kicker (ksubr.c:142)

==6792==    by 0x58E17FF: ??? (in /lib/x86_64-linux-gnu/libc-2.19.so)

==6792==  Address 0x5e9e2c8 is 312 bytes inside a block of size 1,104
alloc'd

==6792==    at 0x4C2AC3D: malloc (vg_replace_malloc.c:299)

==6792==    by 0x47F9B4: mallocw (unix.c:255)

==6792==    by 0x47F9F0: callocw (unix.c:269)

==6792==    by 0x4555DC: newproc (kernel.c:79)

==6792==    by 0x40422C: main (main.c:620)

 

[clipped]

 

==6792== LEAK SUMMARY:

==6792==    definitely lost: 213,313 bytes in 107 blocks

==6792==    indirectly lost: 19,543 bytes in 3 blocks

==6792==      possibly lost: 1,104 bytes in 1 blocks

==6792==    still reachable: 176,149 bytes in 407 blocks

==6792==         suppressed: 0 bytes in 0 blocks

==6792== Reachable blocks (those to which a pointer was found) are not
shown.

==6792== To see them, rerun with: --leak-check=full --show-leak-kinds=all

==6792== 

==6792== For counts of detected and suppressed errors, rerun with: -v

==6792== Use --track-origins=yes to see where uninitialised values come from

==6792== ERROR SUMMARY: 85387 errors from 1052 contexts (suppressed: 0 from
0)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tapr.org/pipermail/nos-bbs_lists.tapr.org/attachments/20160815/4b741a85/attachment.html>


More information about the nos-bbs mailing list