Skip to content
Advertisement

valgrind on raspberry Pi 2 invalid read by libtasn1

I’m currently trying to find a memory leak with valgrind on my Raspberry pi 2 Model b.

My project is using the following compiler flags

-g -o1 -lGLESv2 -lEGL -lbcm_host -lvcos -lvchiq_arm -lopenmaxil -lpthread -lcurl -lm -lfreetype -lssl -lavcodec -lavformat -lswscale -lavutil -ldl -lao -lcrypto

For debugging purposes i have removed all the code in my main function so it looks like:

#include "stdio.h"

int main()
{
    printf("Hallo");
    return 0;
}

System uname -a: Linux debuggingpi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux

valgrind version: valgrind-3.11.0

The output valgrind gives me: valgrind ./application_name

==7730== Memcheck, a memory error detector
==7730== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7730== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==7730== Command: ./ncn_raspberry_jessie
==7730==
==7730== Invalid read of size 8
==7730==    at 0x4861C58: ??? (in /usr/lib/arm-linux-gnueabihf/libarmmem.so)
==7730==  Address 0x6b0f50c is 12 bytes inside a block of size 18 alloc'd
==7730==    at 0x4845478: malloc (vg_replace_malloc.c:299)
==7730==    by 0x6AC2753: ??? (in /usr/lib/arm-linux-gnueabihf/libtasn1.so.6.3.2)
==7730==
==7730== Invalid read of size 8
==7730==    at 0x4861CFC: ??? (in /usr/lib/arm-linux-gnueabihf/libarmmem.so)
==7730==  Address 0x6b0ff9c is 20 bytes inside a block of size 26 alloc'd
==7730==    at 0x4845478: malloc (vg_replace_malloc.c:299)
==7730==    by 0x6AC2753: ??? (in /usr/lib/arm-linux-gnueabihf/libtasn1.so.6.3.2)
==7730==
==7730== Invalid read of size 8
==7730==    at 0x4861CE4: ??? (in /usr/lib/arm-linux-gnueabihf/libarmmem.so)
==7730==  Address 0x6b189ac is 28 bytes inside a block of size 34 alloc'd
==7730==    at 0x4845478: malloc (vg_replace_malloc.c:299)
==7730==    by 0x6AC2753: ??? (in /usr/lib/arm-linux-gnueabihf/libtasn1.so.6.3.2)
==7730==
==7730== Invalid read of size 8
==7730==    at 0x4861BA4: ??? (in /usr/lib/arm-linux-gnueabihf/libarmmem.so)
==7730==  Address 0x6b2aa24 is 20 bytes inside a block of size 26 alloc'd
==7730==    at 0x4845478: malloc (vg_replace_malloc.c:299)
==7730==    by 0x6AC2753: ??? (in /usr/lib/arm-linux-gnueabihf/libtasn1.so.6.3.2)
==7730==
disInstr(arm): unhandled instruction: 0xEE190F1D
                 cond=14(0xE) 27:20=225(0xE1) 4:4=1 3:0=13(0xD)
==7730== valgrind: Unrecognised instruction at address 0x59e5d08.
==7730==    at 0x59E5D08: ??? (in /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0)
==7730== Your program just tried to execute an instruction that Valgrind
==7730== did not recognise.  There are two possible reasons for this.
==7730== 1. Your program has a bug and erroneously jumped to a non-code
==7730==    location.  If you are running Memcheck and you just saw a
==7730==    warning about a bad jump, it's probably your program's fault.
==7730== 2. The instruction is legitimate but Valgrind doesn't handle it,
==7730==    i.e. it's Valgrind's fault.  If you think this is the case or
==7730==    you are not sure, please let us know and we'll try to fix it.
==7730== Either way, Valgrind will now raise a SIGILL signal which will
==7730== probably kill your program.
Hallo==7730==
==7730== HEAP SUMMARY:
==7730==     in use at exit: 0 bytes in 0 blocks
==7730==   total heap usage: 1,223 allocs, 1,223 frees, 82,332 bytes allocated
==7730==
==7730== All heap blocks were freed -- no leaks are possible
==7730==
==7730== For counts of detected and suppressed errors, rerun with: -v
==7730== ERROR SUMMARY: 17 errors from 4 contexts (suppressed: 0 from 0)

Can some one tell me what i’m doing wrong?

Advertisement

Answer

Apply this patch for libtasn1: http://git.savannah.gnu.org/gitweb/?p=libtasn1.git;a=commitdiff;h=f979435823a02f842c41d49cd41cc81f25b5d677

Advertisement