ptrace in production systems

ptrace in production systems

Shachar Shemesh shachar at shemesh.biz
Sun Feb 1 19:33:07 IST 2009


Yedidyah Bar-David wrote:
>
> I agree that using ptrace does not sound very clean. I never used ptrace
> directly, only using strace/ltrace, and these two do sometimes have
> issues, which might be bugs in them but also in ptrace.
The very fact you bundle ltrace into it suggests that ptrace is not the 
problem. Ltrace uses LD_PRELOAD and not ptrace :-)

Either way, this use of ptrace is so basic that I doubt I'll run into 
any such problems.
>  I also read in
> lwn some time ago that there is some project to reimplemnt ptrace using
> some new tracing subsystem, partly because ptrace is considered broken.
>   
 From what I read, the reason for the replacement is that the new system 
is "more complete". FC9 has it and it breaks fakeroot-ng in quite 
horrendous ways, can't say I'm thrilled about it :-(. I have not heard 
of instabilities within ptrace being the reasons (besides the obvious 
platform dependence it has, which is not an issue in this case).
> Don't you have any control on the process you want to restart?
I have full control. The main loop is running through my code, and the 
daemon has an open socket (SEQPACKET) to my controlling daemon. I can 
even detect that it quit by the fact that the SEQPACKET socket will 
disconnect. The problem is that these are all generic interfaces, and 
making allowances for detecting that this particular socket belongs to 
the SNMP agent, or defining a new message to notify of exit are more 
work than the current implementation.

If ptrace is unreliable, then that more work is, of course, necessary. 
If not, I'd rather not invest it.

Lots of intelligent alternative solutions trimmed because they are 
irrelevant.

Shachar



More information about the Linux-il mailing list