Valgrind

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)

Jump to: navigation, search

Valgrind is especially useful in debugging glibc errors. Errors beginning with *** glibc detected *** are errors in Amanda memory allocation detected by glibc. Please report all such problems to the amanda-hackers mailing list or the Amanda forums.

You can disable glibc error detection by setting $MALLOC_CHECK to 1. Please note that this might cause Amanda to fail later.

Contents

Amanda installation changes

  • Since valgrind don't support suexec program, the easiest way to run valgrind is to configure amanda with '--with-user=root'
 ./configure --with-user=root ...
 make
 make install
  • Remove all setuid bit
 cd /install/path
 chmod u-s sbin/amcheck libexec/amcheck libexec/planner libexec/dumper \
   libexec/runtar libexec/rundump
 dumpuser "root"
  • Changes to /etc/xinit.d/amanda
 user = root
  • Create a /root/.amandahosts with the line
 Amandaserver.FQDN root amdump amindexd amidxtaped
Running Amanda as superuser is not recommended.

Using valgrind

Amanda server

Simply prefix all your command with "valgrind "

 valgrind /path/to/amcheck <config>

This will simply analyze the program, not it's child.

For amdump you need --trace-children=yes

 valgrind --trace-children=yes /path/to/amdump <config>

Example: Following command line creates /tmp/xx.* file for each process:

 valgrind --log-file=/tmp/xx --num-callers=20 --leak-check=yes \
  --leak-resolution=high --freelist-vol=100000000 --trace-children=yes

Amanda client

bsd, bsdudp, bsdtcp authentication

change to /etc/xinit.d/amanda

   server      = /usr/bin/valgrind
   server_args = --log-file=/tmp/yy --num-callers=20 --leak-check=yes \
                 --leak-resolution=high --trace-children=yes /path/to/amandad \
                  -auth=YOUR-AUTH amdump amindexd amidxtaped

rsh authentication

In common-src/rsh-security.c (around line 248) Add

       "valgrind", "--log-file=/tmp/xx", "--num-callers=20", "--leak-check=yes", "--leak-resolution=high", "--trace-children=yes"

between rc-hostname and xamandad_path of the execlp call.

ssh authentication

In common-src/ssh-security.c (around line 260 and 265 - 2 places) Add

 "valgrind", "--log-file=/tmp/xx", "--num-callers=20", "--leak-check=yes", "--leak-resolution=high", "--trace-children=yes"

between rc-hostname and xamandad_path of the execlp call.

Personal tools