[Perl/perl5] 300363: Perl_set_context() allow NULL argument

[email protected] (David Mitchell via perl5-changes) Mon, 25 May 2026 07:16:52 -0700
Newsgroups perl.perl5.changes
Message-ID <Perl/perl5/push/refs/heads/davem/thread_races/[email protected]>
  Branch: refs/heads/davem/thread_races
  Home:   https://github.com/Perl/perl5
  Commit: 300363db01fc4e24270f77123e5a8cef52f57f5c
      https://github.com/Perl/perl5/commit/300363db01fc4e24270f77123e5a8cef52f57f5c
  Author: David Mitchell <[email protected]>
  Date:   2026-05-25 (Mon, 25 May 2026)

  Changed paths:
    M embed.fnc
    M proto.h

  Log Message:
  -----------
  Perl_set_context() allow NULL argument

A recent commit of mine made threads set their context to NULL when in
the late stages of being freed - previously they were set briefly to the
main thread's context. In theory at that point the context shouldn't be
used at all; if accessed, it likely indicates a bug.  I decided that
dereffing a null pointer was more likely to obviously show up a fault
than randomly accessing a different thread's context at this point.

This worked out on platforms where PERL_SET_CONTEXT() is implemented
directly; on platforms where it falls back to Perl_set_context(), it was
assert-failing due to the NULL argument.



To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications