[Bug 280318] fork() can deadlock on rtld_phdr_lock

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 17 Jul 2024 03:54:25 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280318

Konstantin Belousov <kib@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kib@FreeBSD.org

--- Comment #1 from Konstantin Belousov <kib@FreeBSD.org> ---
This is expected: we lock phdr lock over the whole dl_iterate_phdr, including
the callback.  To make dl_iterate_phdr() functional after the fork, pre-fork
code also locks the phdr lock. See ef2c2a692b75d644549827b3aaa9f1736940fe85
for some references about the need of the phdr lock.

Since your example blocks in the callback, it is blocked owning the phdr lock,
and fork cannot proceed.

In principle, dl_iterate_phdr() is not required to be useful after fork().
I can add a knob to select the behavior, but I do not see how could it be
made both.

-- 
You are receiving this mail because:
You are the assignee for the bug.