Search code examples
dockervalgrind

valgrind reports "Operation not permitted" but permissions seem to be ok


I want to run valgrind to monitor a program binary named contextBroker this way:

valgrind -v --leak-check=full --track-origins=yes --trace-children=yes contextBroker

but I get this error message:

valgrind: /usr/bin/contextBroker: Operation not permitted

(It happens that the contextBroker binary is in /usr/bin/)

First thing I though was some kind of problem with permissions. However:

  • I run the valgrind command as root user

  • The permissions of the /usr/bin/contextBroker are even wider:

    ls /usr/bin/contextBroker -l
    -rwxr-xr-x 1 root root 7108992 Jun  3 18:15 /usr/bin/contextBroker
    

Additional facts:

  • The contextBroker binary works fine, e.g. if I run it using contextBroker it works.
  • valgrind version is 3.16.0
  • I'm running the valgrind command within a docker container. The same command in the hosting system works (although the valgrind version in the host is slightly different: 3.12.0.SVN)

How I can solve this problem and run valgrind on my process? Thanks!


Solution

  • Using --privileged in the docker run command line solved this issue.

    Thanks Nick ODell for the hint! :)