[Xorp-users] rip on freebsd

Bruce Simpson bms at incunabulum.net
Tue May 12 00:26:06 PDT 2009


Bruce Simpson wrote:
> I will dig up this script and modify it to use ktrace instead of gdb; it 
> is essential that the problem gets pinned down to a particular set of 
> socket syscalls.
>   

Here's that script. This is intended for trapping the creation of a XORP 
child process and hooking GDB up to it, I think I wrote it to debug a 
DoS in the XRL input path, it is probably in Bugzilla somewhere also. As 
written here, it is intended for use under Gentoo Linux.

To modify it to ktrace a FreeBSD process, do the following:
 * Uncomment the 'if' conditional inside the 'until' loop, and uncomment 
the 'last=!?' line.
 * Uncomment the line containing 'killall -s -0'. This just uses 
'killall' to find out the process ID of whatever process name you pass 
to the script.
 * Comment out the line containing 'pidof' and uncomment the line above 
that (pidof is linux-specific, and we need the last field output which 
is the process ID).
 * Comment out the 'exec' line(s) at the end, and just rewrite that to 
do 'exec ktrace -f /tmp/xorp_fea.ktrace -p $pid'.
 * Comment 'sleep 0.2', uncomment 'sleep 1' -- FreeBSD's sleep is 
strictly POSIX and won't sleep for less than a second.

Pass xorp_fea as the command line parameter to this script. Run at the 
same time as when you run xorp_rtrmgr to start XORP in another shell. 
This can be racy, remember this shell will only wake up every second to 
check if the process is now there.

Using 'kdump -E -r -f /tmp/xorp_fea.ktrace' should shed more light on 
what syscalls the FEA is invoking when the multicast socket failure is 
encountered. kdump knows how to decode some setsockopt() calls in a 
human-readable format, but not all.

Alternatively, you could just ktrace xorp_rtrmgr and all children; this 
will not race xorp_fea's creation, but will produce LOTS of output. You 
could also hack the FEA's template file to run xorp_fea under ktrace 
directly, which is how I usually ran valgrind to find various QA issues 
in XORP.

thanks,
BMS

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: trapgdb.sh
Url: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-users/attachments/20090512/65a219f1/attachment.ksh 


More information about the Xorp-users mailing list