This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag

Homepage

About Us

Contact Us

Legal Info

How To Contribute

Security Issues

21 December 2007 Heartbeat release 2.1.3 is now out Download it and install it!

11 October 2007 NEW educational HA/DR Blog hosted by Alan Robertson

9 April 2007 Check out the Cool Heartbeat Screencasts: Installation, Intro to the GUI Part of the Heartbeat Education project

Last site update:
2008-05-17 06:22:18

Getting Core Dumps

It can be difficult to get core dumps for Heartbeat - because the code is security conscious and switches user ids back and forth to make it difficult to exploit the code to get root permissions. We have made progress on this, and so have the OS vendors, so these descriptions have several parts depending on what version and OS you're running.

  1. General Core Dump Enabling

    1. If your version of Heartbeat supports a coredumps directive, you should enable it.

    2. If your version does not support the coredumps directive, then you should start Heartbeat from a shell where you've executed this command:

      ulimit -c unlimited
      
      otherwise all core dumps will likely be prohibited.
  2. Enabling unique core files

    If your kernel has the /proc file /proc/sys/kernel/core_uses_pid, then you should execute this command: echo 1 > /proc/sys/kernel/core_uses_pid. If your kernel doesn't support this, then it's probably not a problem, but enable it if you can.

  3. Enabling core dumps for setuid processes

    1. Release 2 should not need this step (if seems to need this, please let us know).

    2. If you're running a kernel which has the file /proc/sys/kernel/suid_dumpable, then you should execute this command: echo 2 > /proc/sys/kernel/suid_dumpable.

    3. If you're not running release 2, and your kernel does not support the suid_dumpable capability and the process which is dying and should produce a core dump isn't, then you will likely have to make a source change to Heartbeat and recompile.

      The source file you want to change is lib/clplumbing/uids.c. This file ought to start with a section of code that looks about like this:

      int     /* Become nobody - and remember our original privileges */
      drop_privs(uid_t uid, gid_t gid)
      {
              int     rc;
              gid_t   curgid = getgid();
      
              if (!anysaveduid) {
                      poweruid=getuid();
                      powergid=curgid;
              }
      

      We need to make this code into a no-op, so inserting a return after the declarations ought to do it.

      int     /* Become nobody - and remember our original privileges */
      drop_privs(uid_t uid, gid_t gid)
      {
              int     rc;
              gid_t   curgid = getgid();
      
              return; /* Disable security precautions DON'T LEAVE THIS IN HERE FOREVER! */
      
              if (!anysaveduid) {
                      poweruid=getuid();
                      powergid=curgid;
              }
      

      Now, recompile and reinstall Heartbeat.

  4. Core dump locations. Heartbeat core dumps should show up in one of these two locations - depending on the release of Heartbeat you're using:

    • /etc/ha.d

    • /var/lib/heartbeat/cores/*

Now, you should get core dumps when a Heartbeat process ought to core dump.

See Also

coredumps directive, suid_dumpable patch