Faster than what I've expected, I've found what caused the segfault:
Pcap.xs is allowing unsafe signals during the callback. I don't know
why upstream did this, but this has to be discussed with them and
filled as a bug in CPAN.

With the attached patch, my original testcase no longer segfaults.

On Sat, Feb 14, 2009 at 21:32, Martín Ferrari <tin...@debian.org> wrote:
> On Sat, Feb 14, 2009 at 21:08, Martín Ferrari <tin...@debian.org> wrote:
>> Meanwhile this is solved, see the attached patch that's useful as a
>> workaround for fwknopd
>
> My bad, that patch didn't work. It goes again, this time correctly tested :)
>
>
> --
> Martín Ferrari
>



-- 
Martín Ferrari
Index: Pcap.xs
===================================================================
--- Pcap.xs	(revision 30710)
+++ Pcap.xs	(working copy)
@@ -410,10 +410,7 @@
 		callback_fn = newSVsv(callback);
 		user = newSVsv(user);
 
-		SAVE_signals = PL_signals;  /* Allow the call to be interrupted by signals */
-		PL_signals |= PERL_SIGNALS_UNSAFE_FLAG;
 		RETVAL = pcap_loop(p, cnt, callback_wrapper, (u_char *)user);
-		PL_signals = SAVE_signals;
 
 		SvREFCNT_dec(user);
 		SvREFCNT_dec(callback_fn);

Reply via email to