Tag Archives: valgrind

Hacking Valgrind

This post talks about 3 commits I have recently added into my own valgrind tree [1], including the support for fsgsbase instructions, rdrand/rdseed instructions, and adding a new trapdoor (client request) to support gdb-like add-symbol-file command. Note that all these … Continue reading

Posted in Dave's Tools, Programming | Tagged , , , , , , , , , | Leave a comment

Valgrind trapdoor and fun

Valgrind has a client request mechanism, which allows a client to pass some information back to valgrind. This includes asks valgrind to do a logging in its own environment, tells valgrind a range of VA being used as a new … Continue reading

Posted in Programming, Security | Tagged , , , | Leave a comment

Valgrind – dynamic code analysis tool – part VII – ERROR: ld.so: object ‘/dev/shm/valgrind/lib/valgrind/vgpreload_core-amd64-linux.so’ from LD_PRELOAD cannot be preloaded: ignored.

Recently encountered a ld error when starting 64-bit valgrind (3.7.0) for 64-bit binary. This is a bug in 3.7.0 and the fix will be submitted into 3.8.0. Detailed info could be found via (https://bugs.kde.org/show_bug.cgi?id=286270). As always, we could either checkout … Continue reading

Posted in Static Code Analysis | Tagged , , | Leave a comment

Valgrind – dynamic code analysis tool – part VI – configure: error: please use gcc >= 3.0 or clang >= 2.9

This post is trying to figure out the reason why configure of valgrind may report the error like this – configure: error: please use gcc >= 3.0 or clang >= 2.9 and the stupid workaround to make the building go … Continue reading

Posted in Static Code Analysis | Tagged , , | Leave a comment

Valgrind – dynamic code analysis tool – part V – valgrind: failed to start tool ‘memcheck’ for platform …

This post contains certain error message when ‘Valgrind’ is called: valgrind: failed to start tool ‘memcheck’ for platform ‘XXXXXX’: No such file or directory. There is a tricky question – can 32-bit valgrind be run on 64-bit platform? The answer is … Continue reading

Posted in Static Code Analysis | Tagged , , | Leave a comment

Valgrind – dynamic code analysis tool – part IV – DRD

Valgrind – DRD – while Helgrind is the major tool for concurrency issue detection, some options of DRD are also helpful on debugging concurrency issue, especially –exclusive-threshold, used to report mutex locked for long, and –shared-threshold, used to report shared … Continue reading

Posted in Static Code Analysis | Tagged , , , , , | Leave a comment

Valgrind – dynamic code analysis tool – part III – Helgrind

Valgrind – Helgrind – concurrency issue detection. # Helgrind http://valgrind.org/docs/manual/hg-manual.html –tool=helgrind [root@localhost valgrindTest]# cat simpleDataRace.c /* Code from Valgrind Manual */ #include <pthread.h> int var = 0; void* child_fn ( void* arg ) { var++; /* Unprotected relative to parent … Continue reading

Posted in Static Code Analysis | Tagged , , | 1 Comment

Valgrind – dynamic code analysis tool – part II – fd leak

Valgrind – File descriptor (fd) leak detection trial # File descriptor (fd) leak detection –track-fds=yes [root@localhost valgrindTest]# cat fdLeakTry.c /* daveti’s stupid code for fd leak */ #include <stdio.h> int main( int argc, char *argv[]) { FILE *fdPtr = fopen(“daveti.log”, … Continue reading

Posted in Static Code Analysis | Tagged , , | Leave a comment

Valgrind – dynamic code analysis tool – part I – basic trial and hints

We are recently trying to find a tool providing the ability for concurrency issue detection. For this topic, generally, I believe in 3 steps: 1. CPR (capacity, performance, redundancy) testing, 2. Static code analysis, 3. Dynamic code analysis. CPR testing … Continue reading

Posted in Static Code Analysis | Tagged , , , | 1 Comment