diff options
author | Yves Orton <demerphq@gmail.com> | 2022-08-28 12:09:51 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-09-02 10:05:42 +0200 |
commit | 741a5c7396a0ca90a22ea8d8e0761c70c14b0a77 (patch) | |
tree | 0c442705b8ff90ebda90515e6c601ab6784af8fb /INSTALL | |
parent | cd55125d69f5f698ef7cbdd650cda7d2e59fc388 (diff) | |
download | perl-741a5c7396a0ca90a22ea8d8e0761c70c14b0a77.tar.gz |
op.c - Restrict nested eval/BEGIN blocks to a user controllable maximum
Nested BEGIN blocks can cause us to segfault by exhausting
the C stack. Eg:
perl -le'sub f { eval "BEGIN { f() }" } f()'
will segfault. This adds a new interpreter var PL_eval_begin_nest_depth
to keep track of how many layer of eval/BEGIN we have seen, and a new
reserved variable called ${^MAX_NESTED_EVAL_BEGIN_BLOCKS} which can be
used to raise or lower the limit. When set to 0 it blocks BEGIN entirely,
which might be useful from time to time.
This fixes https://github.com/Perl/perl5/issues/20176
Diffstat (limited to 'INSTALL')
-rw-r--r-- | INSTALL | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -528,6 +528,38 @@ C<-Accflags=-DNO_PERL_HASH_ENV>. The C<PERL_HASH_SEED_DEBUG> environment variable can be disabled by configuring perl with C<-Accflags=-DNO_PERL_HASH_SEED_DEBUG>. +=head3 MISCELLANEOUS CONFIG + +Perl uses various defines to control defaults for its behavior. These +values are chosen to represent "sane" config, but users can override +these values in their builds if they wish. This is a list of such +settings. + +=over 2 + +=item PERL_MAX_NESTED_EVAL_BEGIN_BLOCKS_DEFAULT + +This define is used to control the default maximum number of nested +eval/BEGIN statements, and in this context require should be +understood to be a special form of eval so this means require/BEGIN +and "use" statements as well. + +Currently each C<BEGIN> block inside of an C<eval EXPR> or C<require> +operation will use a fairly high number of frames of the perl internal +C stack, and this value is used to prevent stack overflows. Normally +it is defaulted to 1000 but the default can be configured to another +value, for instance 100, like this + + -Accflags='-DPERL_MAX_NESTED_EVAL_BEGIN_BLOCKS_DEFAULT=100' + + +If you don't know what this is then it is safe to ignore it. Do not +configure this to 0 or another very low value, it will break a lot of +code. If you want to set it to a low value use the run time variable +C<${^MAX_NESTED_EVAL_BEGIN_BLOCKS}> instead. + +=back + =head3 SOCKS Perl can be configured to be 'socksified', that is, to use the SOCKS |