From nobody Mon Mar 11 00:29:30 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TtHhp3n3Qz5DDBf; Mon, 11 Mar 2024 00:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TtHhp2LyHz4spB; Mon, 11 Mar 2024 00:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710116970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xsfKVwrII5J8m9zw9mWaFWDKr3CLGPbYwL1p0Tpzh6c=; b=sEj+sAMKUVxVnmRwhIlaxVsCix3Rpglxvi7sY3Gw/ULf1Qf+6TxBlxd9aGUtDYtDOiFZsS o7OLXbSnJxfNVIx1edUE8cIMjP3MHljNJDoUrfMoaL45Ozn9iuGgz6o8mHG1HsiAhofM4i +QIzqH1Q5/c/Leh+xeAzkQ8LQIzB523lArcQOG6yOUgU1qIlicMk4PlRBCih5prpg5DmjS 85pwKMDsxs15YJixFEsmOAFdmtVhvOeDaXvsOwhefFDSXdb96wtKOww3FPUKx+opmKBMjk n5ZDXRvden/A+hRBIUiLBFcZRC5J0Pzvqv9IgFSaYpy5LYiq/pZzceMG/VNksA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710116970; a=rsa-sha256; cv=none; b=XzClvUQtvdregDE6vJ6SgI59qLxMfuv2h0nnZc1aXjpKPmcJYbANlM3+A1LoPwCK8cVUXO jpF90INfoqgfJEN3N5SYE4CaPRQVUQZO0Q8rFry9/h4kVdBFaw2ucwhRgPVL/oip6y47o6 9xvq/ixr2koMWGtJMbCL9uiW2hwvqbll+cCgUsYp4cafskjkYMkeUKqa+ecRo8+k3RLcwi 4uQJZ6DvoUB+1W3z/Dlx/fsyGyut5EBRsjWICmgFpQgzGQk7PhIkQiDb8c0ntxteS3OvQd SeNFZKWHWSLI97w1c2SeeoVaO6lzT9TYij9GnrgsDeGawLBw0B5Vg415i++mvQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710116970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xsfKVwrII5J8m9zw9mWaFWDKr3CLGPbYwL1p0Tpzh6c=; b=k66Fr3dXlkK8TNHNEHUrSjQXvdQPQf0gyGG3yxM4XLStCd6nYFRH88hB7+kJ69lfzEZ2zo y6f1UlUdkFbnJdNmbE0SChA5eI3ODN42k1sr14u6uKcJQmMlBZ8r1b3xnbUQKCuqrnQSLP h7MbiQOr1NhqsCvEJRqy+zaCXyhHlNoK2McUnJ/0fIndzrupui77HgUQY+jzGc+JyXLSvu H6iZybDpyYG/7XKKSQRs6ADUrSQqLqTXMBvEObIp8oK4oqEmK46agxCYjamEPdKSVTWHgE phzODXzKTrJnfEIqztTorDM5y/xV5A/Co5hMF674cT8WS4lZt3RtExAwssKGsA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TtHhp1rR0z17G5; Mon, 11 Mar 2024 00:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42B0TUQA094038; Mon, 11 Mar 2024 00:29:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42B0TU9Y094035; Mon, 11 Mar 2024 00:29:30 GMT (envelope-from git) Date: Mon, 11 Mar 2024 00:29:30 GMT Message-Id: <202403110029.42B0TU9Y094035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f8b5e5320eee - stable/14 - libc posix_spawn(): explain why rtld can be used after fork List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f8b5e5320eee75b2dfeb965d485d8f97bae729e0 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f8b5e5320eee75b2dfeb965d485d8f97bae729e0 commit f8b5e5320eee75b2dfeb965d485d8f97bae729e0 Author: Konstantin Belousov AuthorDate: 2024-03-06 07:24:22 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-11 00:25:58 +0000 libc posix_spawn(): explain why rtld can be used after fork (cherry picked from commit 2ce23b1f76721e44646fc98ba4e24a113a6d5972) --- lib/libc/gen/posix_spawn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index d405517ba68d..ee2ce05ff317 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -325,6 +325,11 @@ do_posix_spawn(pid_t *pid, const char *path, * ideal vfork(2) if we get an EINVAL from rfork -- this should only * happen with newer libc on older kernel that doesn't accept * RFSPAWN. + * + * Combination of vfork() (or its equivalent rfork() form) and + * a special property of the libthr rtld locks ensure that + * rtld is operational in the child. In particular, libthr + * rtld locks do not store owner' tid into the lock word. */ #ifdef _RFORK_THREAD_STACK_SIZE /*