This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
my_plvarsp nulling and PERL_GLOBAL_STRUCT_PRIVATE
authorDavid Mitchell <davem@iabyn.com>
Wed, 23 Apr 2014 15:48:15 +0000 (16:48 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 24 Apr 2014 13:34:55 +0000 (14:34 +0100)
commit2ff805474ea6c1b39d98b1eccdce9f1f3538a05a
tree95936cfbf92d7ad724b5a7abf739c4faedaf5bb3
parent75200dff8561a9c5d6eaa86a0ac75874bf13282b
my_plvarsp nulling and PERL_GLOBAL_STRUCT_PRIVATE

With PERL_GLOBAL_STRUCT_PRIVATE, all "global" vars are in a malloc()d
structure pointed to by the static var my_plvarsp. At exit, this struct is
freed and my_plvarsp is set to NULL.

My previous commit c1181d2b skipped the free if PL_veto_cleanup is set
(as it would be if other threads are still running for example), but
still left my_plvarsp getting set to NULL. Thus other threads could still
deref a null pointer if they accessed a "global" var just as the main
thread was exiting.

This commit makes the veto skip the NULLing in addition to the freeing.

This commit is quite late into the code freeze, but it's a follow-up to the
earlier attempt to get smokes not to fail, and all the affected code is
within #ifdef PERL_GLOBAL_STRUCT_PRIVATE, so it shouldn't affect
mainstream builds at all. (Famous last words.)
ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
lib/ExtUtils/t/Embed.t
miniperlmain.c