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

openresty: disable perl module by default #89344

Merged
merged 4 commits into from Jun 20, 2020

Conversation

JJJollyjim
Copy link
Member

@JJJollyjim JJJollyjim commented Jun 2, 2020

Motivation for this change

This creates consistency with the other nginx packages.

Additionally, I have been receiving intermittent segfaults during config loading caused by the perl module (albeit on 20.03), despite there being no reference to perl in my configs:

#0  0x00007f03deb51a63 in Perl__invlist_intersection_maybe_complement_2nd () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#1  0x00007f03deb520a5 in S_populate_ANYOF_from_invlist.part.0 () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#2  0x00007f03deb61adf in S_regclass () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#3  0x00007f03deb683bf in S_regpiece () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#4  0x00007f03deb6ce13 in S_regbranch () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#5  0x00007f03deb6d3b4 in S_reg () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#6  0x00007f03deb722fc in Perl_re_op_compile () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#7  0x00007f03deb0731d in Perl_pmruntime () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#8  0x00007f03deb4371b in Perl_yyparse () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#9  0x00007f03debe4347 in S_doeval_compile () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#10 0x00007f03debe9cad in Perl_pp_require () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#11 0x00007f03deb9f336 in Perl_runops_standard () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#12 0x00007f03deb0d33c in Perl_call_sv () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#13 0x00007f03deb0ff38 in Perl_call_list () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#14 0x00007f03deaed720 in S_process_special_blocks.isra.0 () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#15 0x00007f03deb060ef in Perl_newATTRSUB_x () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#16 0x00007f03deb0967e in Perl_utilize () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#17 0x00007f03deb43bb9 in Perl_yyparse () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#18 0x00007f03debe4347 in S_doeval_compile () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#19 0x00007f03debe9cad in Perl_pp_require () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#20 0x00007f03deb9f336 in Perl_runops_standard () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#21 0x00007f03deb0d33c in Perl_call_sv () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#22 0x00007f03deb0ff38 in Perl_call_list () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#23 0x00007f03deaed720 in S_process_special_blocks.isra.0 () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#24 0x00007f03deb060ef in Perl_newATTRSUB_x () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#25 0x00007f03deb0967e in Perl_utilize () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#26 0x00007f03deb43bb9 in Perl_yyparse () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#27 0x00007f03deb14053 in perl_parse () from /nix/nix/store/...-perl-5.30.1/lib/perl5/5.30.1/x86_64-linux-thread-multi/CORE/libperl.so
#28 0x0000562f8df614ed in ngx_http_perl_create_interpreter (pmcf=0x562f8f4f3920, pmcf=0x562f8f4f3920, cf=0x7ffed953fa50) at src/http/modules/perl/ngx_http_perl_module.c:605
#29 ngx_http_perl_init_interpreter (cf=0x7ffed953fa50, pmcf=0x562f8f4f3920) at src/http/modules/perl/ngx_http_perl_module.c:524
#30 0x0000562f8df61d49 in ngx_http_perl_init_main_conf (conf=<optimized out>, cf=<optimized out>) at src/http/modules/perl/ngx_http_perl_module.c:819
#31 ngx_http_perl_init_main_conf (cf=<optimized out>, conf=<optimized out>) at src/http/modules/perl/ngx_http_perl_module.c:814
#32 0x0000562f8def8729 in ngx_http_block (cmd=<optimized out>, conf=<optimized out>, cf=<optimized out>) at src/http/ngx_http.c:263
#33 ngx_http_block (cf=0x7ffed953fa50, cmd=<optimized out>, conf=<optimized out>) at src/http/ngx_http.c:121
#34 0x0000562f8ded8109 in ngx_conf_handler (last=1, cf=0x7ffed953fa50) at src/core/ngx_conf_file.c:463
#35 ngx_conf_parse (cf=cf@entry=0x7ffed953fa50, filename=filename@entry=0x562f8f4efda0) at src/core/ngx_conf_file.c:319
#36 0x0000562f8ded5959 in ngx_init_cycle (old_cycle=old_cycle@entry=0x562f8f7bfe00) at src/core/ngx_cycle.c:275
#37 0x0000562f8deec25d in ngx_master_process_cycle (cycle=<optimized out>) at src/os/unix/ngx_process_cycle.c:242
#38 0x0000562f8dec31de in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:382

The change from specifying perl = null to withPerl is necessary due to openresty's use of perl in its configure script.

I have tested nginxStable, nginxUnstable, nginxShibboleth, and openresty using my unmerged nginx-variant tests from #89342.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@7c6f434c
Copy link
Member

7c6f434c commented Jun 3, 2020

Hmm, if it was about openresty, wouldn't passing it perl=null; make more sense? The segfault might indeed motivate making the most frequent no-Perl mode the default, but then the description should be talking about this point of view and not just about openresty

@JJJollyjim
Copy link
Member Author

@7c6f434c sure, will do if you want.

@JJJollyjim
Copy link
Member Author

@7c6f434c done.

@7c6f434c
Copy link
Member

I think even this version should still mention switching to the withPerl flag in the commit message (and then you can add one line about segfaults and make withPerl false by default, no problem)

@JJJollyjim
Copy link
Member Author

@7c6f434c done

@7c6f434c
Copy link
Member

Apparently I fail to express what I am actually annoyed by.

You replace perl=null with withPerl globally (for Nginx), not just for openresty (and that's what I asked to mention in the first commit message). The predefined packages stay the same, but the override interface changes.

(In principle, openresty could just check for perl == null instead of the flag, but I can see the motivation to have things in a cleaner way, especially when half of the versions already disable Perl)

@JJJollyjim
Copy link
Member Author

JJJollyjim commented Jun 12, 2020

@7c6f434c I'm still confused sorry. The motivation for all of this, like I explained in the PR, is that I can't check for perl==null, because openresty depends on perl at build time (./configure is written in perl).

@JJJollyjim
Copy link
Member Author

That means that in the status quo it is impossible for a user to turn off perl in openresty (except by overriding to delete some configure flags)

@JJJollyjim
Copy link
Member Author

JJJollyjim commented Jun 12, 2020

I still don't understand what you want at this point. Is the issue that the commit message is not explicit that the change affects all nginx packages?

@7c6f434c
Copy link
Member

Yes — as I said, I agree with the changes themselves.

Previously, http_perl_module was disabled by overriding perl=null -- this means
it is impossible to disable http_perl_module in openresty, since openresty
requires perl for its configure scripts.
I have been experiencing intermittent segfaults inside the perl module on
startup during config parsing, despite not actually using any perl features in
my config.

This creates consistency with the standard nginx packages, and the upstream
openresty binaries.
@JJJollyjim
Copy link
Member Author

@7c6f434c I split this into two commits that are more clear about what they apply to -- hope that seems right to you.

@7c6f434c
Copy link
Member

Thanks!

@7c6f434c 7c6f434c merged commit 132ace5 into NixOS:master Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants