develooper Front page | perl.perl5.porters | Postings from May 2016

Re: [perl #128196] ExtUtils::MakeMaker::FAQ on splliting XS files

Thread Previous
Jeffrey Kegler
May 23, 2016 14:34
Re: [perl #128196] ExtUtils::MakeMaker::FAQ on splliting XS files
Message ID:
I've been UNIX/C programming since the 70's, and Babkin's case is IMHO more
than plausible and not overstated, modulo some minor English as a 2nd
language issues.

Babkin's claim of "crashes" I read to mean program abends -- segment
violations, for example.  I expect English is Babkin's 2nd language, which
would also account for his speaking  of "abuse" of arguments.  I'd assume
he meant something like "misuse", and did not intend the unfortunate ad
hominem implications the term "abuse" carries for a native English speaker.

When C accesses the wrong section of the stack, the results are
unpredictable -- they'll depend on the particular system's architecture.
There may often be no symptoms, which makes such problems worse, not
better, because it means that very serious problems can sneak past even
excellent testing.

IMHO, this is the correct way to proceed:  Babkin has laid out a prima
facie case that the method described is dangerous practice.  Looking at the
code and docs, what Babkin says will happen is what I would expect to
happen if the boot routines work as designed and documented.  This leaves
every reason to think the FAQ's recommendation is dangerous, and no basis
for believing it to be safe.

A counter-argument in favor of the FAQ's recommendation would have to point
out where Babkin's reading/analysis errs, and what does happen with the
stack.  Such a counter-argument need not be lengthy -- references to a few
lines of the code or the docs could suffice.  But my guess is that Babkin's
reading of the docs and code is right and there is no solid
counter-argument that can be made.

On Sat, May 21, 2016 at 3:39 PM, Craig Berry via RT <> wrote:

> On Fri, May 20, 2016 at 9:26 PM, James E Keenan via RT
> <> wrote:
> > On Fri May 20 11:43:04 2016, jeffreykegler wrote:
> >> As of Perl 5.22.0, under the question "How do I make two or more XS
> >> files coexist in the same directory?", ExtUtils::MakeMaker::FAQ has 2
> >> suggestions.  My issue is with the 2nd of these, which describe an
> >> approach that uses statements of the form "boot_Cool__Bar(aTHX_ cv);"
> >> in the "BOOT:" section of the XS file.
> >>
> >> According to
> >> modules-into-multiple-files.html this approach can crash the system if
> >> used with 3 or more files.  Sergey's post is carefully argued, and his
> >> description of the situation AFAICT correct.
> >>
> >> Possible fixes:
> >>
> >> 1.)  Delete the 2nd suggestion, leaving only the suggestion to split
> >> the XS file into multiple directories.
> >>
> >> 2.)  Incorporate Sergey's fix into the FAQ
> >>
> >> Thanks, jeffrey kegler
> >
> > Could we get some of our more XS-fluent contributors to study the Babkin
> blog post and consider Jeffrey's suggestion?
> I'm not that XS-fluent but the blog post sounds plausible.  Note that
> the blog post only claims that the Perl stack can be corrupted and
> says nothing about crashing the system, which does not sound plausible
> unless the OS has serious bugs in its memory protection.
> I'll also note that MakeMaker is maintained upstream.  The current
> version of its FAQ is at
> <
> >
> and changes would need to go there first.  That said, it seems
> reasonable to me to leave the ticket here open for just a bit to
> elicit comment from those who know the details of the Perl stack and
> the boot_XXX mechanism.

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