develooper Front page | perl.perl5.changes | Postings from January 2021

[Perl/perl5] 4190e7: Avoid deadlock with PERL_MEM_LOG

From:
Ricardo Signes via perl5-changes
Date:
January 9, 2021 12:56
Subject:
[Perl/perl5] 4190e7: Avoid deadlock with PERL_MEM_LOG
Message ID:
Perl/perl5/push/refs/heads/maint-5.32/922143-2693be@github.com
  Branch: refs/heads/maint-5.32
  Home:   https://github.com/Perl/perl5
  Commit: 4190e73eba88675cc39af83a5c4ac5905e42c7e5
      https://github.com/Perl/perl5/commit/4190e73eba88675cc39af83a5c4ac5905e42c7e5
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-09 (Sat, 09 Jan 2021)

  Changed paths:
    M util.c

  Log Message:
  -----------
  Avoid deadlock with PERL_MEM_LOG

This fixes GH #18341

The Perl wrapper for getenv() was changed in 5.32 to allocate memory to
squirrel safely away the result of the wrapped getenv() call.  It does
this while in a critical section so as to make sure another thread can't
interrupt it and destroy it.

Unfortunately, when Perl is compiled for debugging memory problems and
has PERL_MEM_LOG enabled, that allocation causes a recursive call to
getenv() for the purpose of checking an environment variable to see how
to log that allocation.  And hence it deadlocks trying to enter the
critical section.

There are various solutions.  One is to use or emulate a general semaphore
instead of a binary one.  This is effectively what
PL_lc_numeric_mutex_depth does for another mutex, and the code for that
could be used as a template.

But given that this is an extreme edge case which requires Perl to be
specially compiled to enable this feature which is used only for
debugging, a much simpler, if less safe if it were to ever be used in
production, solution should suffice.  Tony Cook suggested just avoiding
the wrapper for this particular purpose.

(cherry picked from commit 0cc28fe31b0d416e9c67ecd18b8f38c5833a455a)


  Commit: fa1bc2e4ea514f81f75551539092e7bf6226e8f5
      https://github.com/Perl/perl5/commit/fa1bc2e4ea514f81f75551539092e7bf6226e8f5
  Author: John Lightsey <john@04755.net>
  Date:   2021-01-09 (Sat, 09 Jan 2021)

  Changed paths:
    M dist/Safe/Safe.pm
    M ext/Opcode/Opcode.pm

  Log Message:
  -----------
  Make security warnings in the Safe and Opcode modules more direct.

The current "no warranty" text warning against the use of Safe or
Opcode for "security purposes" is somewhat ambiguous. These modules
are not effective sandboxing mechanisms for evaluating untrusted
perl code and should not be used in that manner.

Safe and Opcode are, at best, hardening measures that could be used
in combination with operating system level sandboxing of the perl
interpreter.

(cherry picked from commit c150e7c040454515c5acfb8416f2acdb2c0a2bb4)


  Commit: 9f289b466f6ebe0aa645eddd42669ee8dbb57cbc
      https://github.com/Perl/perl5/commit/9f289b466f6ebe0aa645eddd42669ee8dbb57cbc
  Author: Andy Dougherty <doughera@lafayette.edu>
  Date:   2021-01-09 (Sat, 09 Jan 2021)

  Changed paths:
    M pod/perlpolicy.pod

  Log Message:
  -----------
  perlpolicy: Adjust the list of moderators.

(cherry picked from commit 48a788454f1719093d08e80bbb70723ae345163a)


  Commit: 942f668e9233a3d2ce9eefb0d0d81ca9a65ef859
      https://github.com/Perl/perl5/commit/942f668e9233a3d2ce9eefb0d0d81ca9a65ef859
  Author: Ricardo Signes <rjbs@semiotic.systems>
  Date:   2021-01-09 (Sat, 09 Jan 2021)

  Changed paths:
    M MANIFEST
    M pod/perl.pod
    A pod/perlgov.pod
    M win32/pod.mak

  Log Message:
  -----------
  perlgov: the perl governance document

(cherry picked from commit 05a3a9e270acbdb476e3ca1a8ef39a7eaf374406)


  Commit: 99c3df251c357bbd707a48012994022f4286b542
      https://github.com/Perl/perl5/commit/99c3df251c357bbd707a48012994022f4286b542
  Author: Ricardo Signes <rjbs@semiotic.systems>
  Date:   2021-01-09 (Sat, 09 Jan 2021)

  Changed paths:
    M pod/perl.pod
    M pod/perlgov.pod

  Log Message:
  -----------
  perlgov: formatting tweaks from code review

(cherry picked from commit f8e911a1fee93e2ec18731a39a30b6c880c64951)


  Commit: 0497f97c75fb0479d3c7d5ab82d060edfb18e9b9
      https://github.com/Perl/perl5/commit/0497f97c75fb0479d3c7d5ab82d060edfb18e9b9
  Author: Ricardo Signes <rjbs@semiotic.systems>
  Date:   2021-01-09 (Sat, 09 Jan 2021)

  Changed paths:
    M pod/perlgov.pod

  Log Message:
  -----------
  perlgov: add a missing "the" and remove a full stop

(cherry picked from commit 159f10880013e565e0bc0f6347e036c8a947c267)


  Commit: 2693bef3c97701c246466329ed4ef1794f4b15ad
      https://github.com/Perl/perl5/commit/2693bef3c97701c246466329ed4ef1794f4b15ad
  Author: Ricardo Signes <rjbs@semiotic.systems>
  Date:   2021-01-09 (Sat, 09 Jan 2021)

  Changed paths:
    M pod/perlhack.pod
    M pod/perlhist.pod
    M pod/perlpolicy.pod
    M pod/perlsecpolicy.pod

  Log Message:
  -----------
  pod: update a few documents for perlgov changes

(cherry picked from commit 66c65f79d3ac3abda04a869359d6f034ab2c32aa)


Compare: https://github.com/Perl/perl5/compare/922143f2c5dc...2693bef3c977



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About