gpg-agent makes no attempt to disable using ptrace on Linux to extract sensitive
information - such as pass phrases.
This can be observed with the following command and grepping through the
resulting core file for recently entered passphrases:
gcore pidof gpg-agent
While ptrace can be disabled by installing gpg-agent setguid, it is recommended
to [also] add the following code (from openssh) early in the main routine to
disable it regardless (you will also need the appropriate autoconf foo to check
for the prctl header and prctl function - grep the openssh source for prctl and
ptrace for more details as well as a regression test):
#if defined(HAVE_SYS_PRCTL_H)
#include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */
#endif
...main()...
#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
/* Disable ptrace on Linux without sgid bit */
prctl(PR_SET_DUMPABLE, 0);
#endif
This does not prevent the root user from using ptrace on the agent, but it would
prevent another process of the same user from casually running ptrace on an
already running gpg-agent.
Thanks,
-Ian