develooper Front page | perl.perl5.porters | Postings from July 2018

[perl #133327] stack checks make -DDEBUGGING builds incompatiblewith normal ones

Thread Next
bulk88 via RT
July 4, 2018 15:02
[perl #133327] stack checks make -DDEBUGGING builds incompatiblewith normal ones
Message ID:
On Tue, 03 Jul 2018 08:49:38 -0700, wrote:
> This is a bug report for perl from Niko Tyni <>,
> generated with the help of perlbug 1.41 running under perl 5.28.0.
> -----------------------------------------------------------------
> The stack 'high water mark' checks introduced in v5.27.1-66-
> g87058c31e9
> seem to have introduced an incompatibility when XS modules are built
> with a normal Perl but run with a (otherwise similarly configured)
> We're using this combination in Debian as we offer a -DDEBUGGING
> interpreter (called /usr/bin/debugperl) in a separate package for the
> benefit of our users, but we don't rebuild all the XS modules with
> that.
> It would be useful for us to keep these builds binary compatible.
> Last time an incompatibility happened it was deemed worth fixing:
> see [perl #127212] and Aaron's related commit message in 5ca5a62834a7f
> .
> Some symptoms of the breakage:
> # debugperl -MDateTime -e 'print DateTime->today'
> panic: XSUB DateTime::_rd2ymd (DateTime.c) failed to extend arg stack:
> base=55b63e6b3b48, sp=55b63e6b3b80, hwm=5
> 5b63e6b3b68
> # printf '<AAA>\n<DDD/><CCC><DDD>\n</DDD></CCC>\n</AAA>' | debugperl
> -MXML::LibXML -e 'XML::LibXML->new->parse_f
> h(*STDIN)->documentElement->childNodes; '
> panic: XSUB XML::LibXML::Node::_childNodes (LibXML.c) failed to extend
> arg stack: base=561827c61b48, sp=561827c6
> 1b68, hwm=561827c61b60
> These are just examples, and I believe the fault is not with the
> modules.
> If I grok this correctly, the problem is that EXTEND only updates
> the high-water mark when the DEBUGGING preprocessor symbol is defined
> (i.e. the choice is done at compile time.) If the XS module is built
> without -DDEBUGGING in ccflags (as is the case for Debian XS module
> packages), the high-water mark doesn't get updated.  If the
> interpreter
> side is built with -DDEBUGGING (as our debugperl is), it will still
> check the hwm, resulting in the panic.
> Would it be feasible move the -DDEBUGGING check in EXTEND to run time,
> for instance by calling a function that's a no-op in non-DEBUGGING
> interpreters, or checking for an interpreter variable that's only set
> in -DDEBUGGING builds? This has a runtime cost, but I'm not sure how
> significant that is?

DEBUGGING is a build option, either the whole interp has it or it doesn't. P5P already questionably added struct fields that are unused on non-DEBUGGING to make DEBUGGING vs not binary compatible but I disagree with that quick fix. Perhaps perl.h should be tweaked to turn on libc assert() without rest of DEBUGGING features and /usr/bin/debugperl should be compiled with that just-libc-assert flag.

bulk88 ~ bulk88 at

via perlbug:  queue: perl5 status: open

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About