Bug#810326: perl-debug: can't load XS modules anymore (handshake failure)

Niko Tyni ntyni at debian.org
Fri Jan 8 12:48:26 UTC 2016


Control: tag -1 patch

On Fri, Jan 08, 2016 at 11:19:03AM +0000, Dominic Hargreaves wrote:
> On Fri, Jan 08, 2016 at 12:50:37PM +0200, Niko Tyni wrote:
> > Package: perl-debug
> > Version: 5.22.1-3
> > Severity: important
> > 
> > Since 5.22, the 'debugperl' binary in perl-debug (built with
> > -DDEBUGGING=both) has become remarkably less useful.
> > 
> >   % debugperl -e 'use Cwd'
> >   Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xdc80080)
> > 
> > I suspect this is not easily fixable. Possibly we should
> > rather drop it altogether than give false expectations.
> 
> bulk88's comment at [1] ("A wild guess is you have -DDEBUGGING on the
> cmd line to the CC in your module. DEBUGGING can only be set at perl
> interp build time, not randomly, per module, afterwards.") sounds like
> there is an expectation that turning on debugging shouldn't break
> the handshaking? If so, perhaps there is a bug here that could be
> addressed upstream - which would obviously be good news for any
> binary distribution.
> 
> [1] <https://rt.perl.org/Public/Bug/Display.html?id=125236>

Yes, the key question is if -DDEBUGGING really affects ABI compatibility
or if this is just a paranoid handshake failure. This:

 http://perl5.git.perl.org/perl.git/commit/f2b88940d815760ad254d35a0ee1eb2ed8ce7762

  /* name of the scopes we've ENTERed. Only used with -DDEBUGGING, but needs to be
     present always, as -DDEBUGGING must be binary compatible with non.  */

implies any -DDEBUGGING incompatibilities are not intentional.

The handshake failure is a result of differing interpreter sizes between
perl and debugperl.

  % for p in perl debugperl; do gdb --batch --silent /usr/bin/$p -ex 'print sizeof(struct interpreter)'; done
  $1 = 3504
  $1 = 3528

FWIW, the sizes differ on jessie (5.20) too. On both 5.20 and 5.22, the
difference is due to a 'memory_debug_header' member that gets inserted
at almost the end, moving (only!) 'sv_consts' and 'random_state' 24
bytes forward on amd64.

The 'memory_debug_header' member is conditional on PERL_TRACK_MEMPOOL,
which comes with -DDEBUGGING. Judging by 'git annotate', this isn't new
in any way.

Conclusions:

1) if upstream is aiming for ABI compatibility with -DDEBUGGING, there
   seems to be a long standing bug with that
2) the resulting incompatibility is apparently minor enough that things
   have been working until now, but started to fail with the strict
   handshake checking in 5.22
3) we can work around this by unsetting PERL_TRACK_MEMPOOL
   for debugperl, which would be an acceptable tradeoff IMO;
   a lightly tested patch attached.

I'll bring 1) up upstream.
-- 
Niko Tyni   ntyni at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0049-Disable-PERL_TRACK_MEMPOOL-for-debugging-builds.patch
Type: text/x-diff
Size: 844 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/perl-maintainers/attachments/20160108/9eab7e30/attachment.patch>


More information about the Perl-maintainers mailing list