On Mon, Mar 10, 2008 at 10:53:54PM -0700, Philippe M. Chiasson wrote:

> >>Niko Tyni wrote:
> >>>We're switching to Perl 5.10 in Debian soon, and I'm trying to update the
> >>>mod_perl2 package to keep it working. Unfortunately the ModPerl-Registry
> >>>test suite is failing on the Sparc architecture because apache2 is killed
> >>>by a bus error (SIGBUS).

> How about this s/U16/U32/ diff, basically keeping the flag type at U32,
> since it was not an essential part of the fix itself.

No, that doesn't help either.

It turns out the U16/U32 thing was a bad guess on my part. After
some code staring and debugging, I found the real bug. It's not
architecture-specific really, it just happens to bite worst on Sparc.

The non-void function modperl_thx_interp_get() function is doing a
plain 'return;' when it means to 'return NULL;'. The result is that the
MP_APR_POOL_SV_TAKES_OWNERSHIP() macro increments a more or less random
memory location, in this case my_perl->tScopestack aka. PL_scopestack,
making it non-aligned as a side effect.

Patch attached; this fixes the bus error for me.

Cheers,
-- 
Niko Tyni   [EMAIL PROTECTED]
Index: src/modules/perl/modperl_interp.c
===================================================================
--- src/modules/perl/modperl_interp.c	(revision 635485)
+++ src/modules/perl/modperl_interp.c	(working copy)
@@ -581,7 +581,7 @@
     modperl_interp_t *interp;
     dTHXa(thx);
     SV **svp = hv_fetch(PL_modglobal, MP_THX_INTERP_KEY, strlen(MP_THX_INTERP_KEY), 0);
-    if (!svp) return;
+    if (!svp) return NULL;
     interp = INT2PTR(modperl_interp_t *, SvIV(*svp));
     return interp;
 }

Reply via email to