Valgrind for MIPS 64 is giving invalid memory access for basic dynamic allocations

39 views Asked by At

Getting below output while running valgrind for MIPS64:

-bash-4.3# bin/valgrind ./a.out Memcheck, a memory error detector Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info

Command: ./a.out

Invalid read of size 8
   at 0x40B6EE4: __ctype_init (in /lib64/libc.so.6)
   by 0x40A7C8C: _init (in /lib64/libc.so.6)
   by 0x40129D8: call_init (in /lib64/ld-2.16.so)
   by 0x4012BC8: _dl_init (in /lib64/ld-2.16.so)
   by 0x400328C: _dl_start_user (in /lib64/ld-2.16.so)
 Address 0xffffffffffff9000 is not stack'd, malloc'd or (recently) free'd

Process terminating with default action of signal 10 (SIGBUS)
   at 0x40B6EE4: __ctype_init (in /lib64/libc.so.6)
   by 0x40A7C8C: _init (in /lib64/libc.so.6)
   by 0x40129D8: call_init (in /lib64/ld-2.16.so)
   by 0x4012BC8: _dl_init (in /lib64/ld-2.16.so)
   by 0x400328C: _dl_start_user (in /lib64/ld-2.16.so)
Invalid read of size 4
   at 0x4019508: __dl_runtime_resolve (in /lib64/ld-2.16.so)
   by 0x40192D8: _dl_runtime_resolve (in /lib64/ld-2.16.so)
 Address 0xffffffffffff8900 is not stack'd, malloc'd or (recently) free'd

Process terminating with default action of signal 10 (SIGBUS)
   at 0x4019508: __dl_runtime_resolve (in /lib64/ld-2.16.so)
   by 0x40192D8: _dl_runtime_resolve (in /lib64/ld-2.16.so)

HEAP SUMMARY:
    in use at exit: 0 bytes in 0 blocks
  total heap usage: 0 allocs, 0 frees, 0 bytes allocated

All heap blocks were freed -- no leaks are possible

For counts of detected and suppressed errors, rerun with: -v
ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
 Bus error

Valgrind Libraries used: 3.13, 3.15 and 3.22 but same issue.

while(1)
{
   int *ptr = (int *)malloc(sizeof(int));

   *ptr = 1;
   printf("#### Ptr %d\n", *ptr);

   free(ptr);
   sleep(1);
}
0

There are 0 answers