4

Executing a binary compiled with gcc 7.2.0+ASan fails on Ubuntu 17.10 docker container with following error:

==5==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
Mohammad Azim
  • 2,604
  • 20
  • 21

1 Answers1

7

LSan (that performs leak checks) attaches to the program under test via ptrace. It fails to do so under docker as it does not have permissions. This can be fixed by running docker container with privileges using either of the two options:

docker run ....   --privileged

or more specific:

docker run ....   --cap-add SYS_PTRACE

--cap-add SYS_PTRACE is a much more preferred option for CI and automation as it restricts privileges to ptrace only.

Mohammad Azim
  • 2,604
  • 20
  • 21