ptrace in production systems

ptrace in production systems

Oron Peled oron at actcom.co.il
Sun Feb 1 22:56:50 IST 2009


On Sunday, 1 בFebruary 2009, Shachar Shemesh wrote:
> Then again, it is a daemon. It has no parent (well, init is its parent).

It's not clear from your description (or your replies to other posters)
why you don't want init to babysit this daemon. So I'll explore two
possibilities:
1. The daemon should be simply rerun whenever it dies. In that case:
   * As someone else mentioned, you need some option for it not to
     double fork. (hmmm... what if it doesn't have this option and
     don't have the source? is this problem?)
   * Afterward, simply add it to inittab with respawn.
   * Yes, I have understood you use busybox. AFAIR, its botched init
     does have some minimal inittab look-alike (not SysV like) so you
     can respwan services.

2. The daemon need some special startup (what?) that can only be done
   by your other daemon (e.g: using some secret info only known to it):
   * As Didi suggested patch busybox init to send a signal to you
     when your SNMP agent dies (use init as proxy).
   * The init stuff in busybox is really simple, i've once played with
     it.
   * The missing part is designing how to specify the process to
     be watched and the process to receive the notification -- if a
     specification by name is good enough, than maybe an extension
     to the inittab syntax (which isn't standard anyway) could be
     added. Something like:
      foo:345:respawnsig:snmp-agent:foobardaemon
     (OK, I used SysV syntax because I don't remember the exact fields
      in busybox inittab).


-- 
Oron Peled                                 Voice: +972-4-8228492
oron at actcom.co.il                  http://www.actcom.co.il/~oron
Linux: Opening doors and shattering Windows.




More information about the Linux-il mailing list