Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtUtils::MakeMaker::FAQ on splliting XS files #15342

Closed
p5pRT opened this issue May 20, 2016 · 8 comments
Closed

ExtUtils::MakeMaker::FAQ on splliting XS files #15342

p5pRT opened this issue May 20, 2016 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented May 20, 2016

Migrated from rt.perl.org#128196 (status was 'rejected')

Searchable as RT128196$

@p5pRT
Copy link
Author

p5pRT commented May 20, 2016

From jkegl@cpan.org

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 http​://babkin-cep.blogspot.com/2012/10/splitting-xs-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

@p5pRT
Copy link
Author

p5pRT commented May 21, 2016

From @jkeenan

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 http​://babkin-cep.blogspot.com/2012/10/splitting-xs-
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?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented May 21, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 21, 2016

From @craigberry

On Fri, May 20, 2016 at 9​:26 PM, James E Keenan via RT
<perlbug-followup@​perl.org> 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 http​://babkin-cep.blogspot.com/2012/10/splitting-xs-
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
<https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/blob/master/lib/ExtUtils/MakeMaker/FAQ.pod>
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.

@p5pRT
Copy link
Author

p5pRT commented May 23, 2016

From jeffreykegler@jeffreykegler.com

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 <
perlbug-followup@​perl.org> wrote​:

On Fri, May 20, 2016 at 9​:26 PM, James E Keenan via RT
<perlbug-followup@​perl.org> 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 http​://babkin-cep.blogspot.com/2012/10/splitting-xs-
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
<
https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/blob/master/lib/ExtUtils/MakeMaker/FAQ.pod

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.

@p5pRT
Copy link
Author

p5pRT commented May 23, 2016

From @iabyn

On Sat, May 21, 2016 at 05​:38​:46PM -0500, Craig A. Berry wrote​:

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.

At a quick glance the analysis and proposed fix look plausible to me.

--
It's not that I'm afraid to die, I just don't want to be there when it
happens.
  -- Woody Allen

@p5pRT
Copy link
Author

p5pRT commented May 25, 2016

From @xsawyerx

On 05/21/2016 04​:26 AM, 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 http​://babkin-cep.blogspot.com/2012/10/splitting-xs-
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?

Thank you very much.

My understanding of XS is relatively limited, but I could follow what
Sergey wrote, and providing this in the FAQ is a reasonable change to me.

That's just my 2 cents. The FAQ is maintained by the CPAN Toolchain
developers, so it would be their decision.

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2016

@iabyn - Status changed from 'open' to 'rejected'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant