From nobody Wed Mar 06 07:50:48 2024 X-Original-To: dev-commits-src-all@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 4TqPkJ6JV1z5C1K9; Wed, 6 Mar 2024 07:50:48 +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 4TqPkJ4kw1z4hfm; Wed, 6 Mar 2024 07:50:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709711448; 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=lDkqyFKrLOaYCTs5H3/YAly7qBAEVVtReDFlYzPU5NM=; b=YKwkIG7CwsbEyBpXspT5D4GMD+5FIAYPhAFyH4VaOBPkBjHPpcICKrj9ZDNz1W0xG8SQW3 jmlqqLCxTRIW+DOKAJ72xujvQNbkwKGin5cfOtcJIGnehDWnyzI4K3OTGz4QB2KlFsFKrJ C5fMDbNAGvOSzE2AsTeGia1SWXsqhYWY0iJnilbahYDFi0hHnklYAV3DdYG3jWVqWfGrFM YK5RBdlmjCess5eHJjdYsYItwPkmw5aIW+Z/p1ECPEXujIP0YLnLRhwBiblLdExtQpcBog YolDgKy1jUnjEaDCH3FcJjn4zbe96Xe5z54Hg18H5XFL+wn/WDJtLROHXBu9ug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709711448; a=rsa-sha256; cv=none; b=caWvJKgCk9hFtAdSGipg1nmR+XLxDFsCGsQOgNEvG3iwEghvNNaL1BFWYvpm3A5Nf5uQDB ZSXoxZbE7NE504AxIporjbU5FK9BseQxc5IdC/spAtqDkGg4s1+NPSdUOesJXGLleaq+Gb sA6HH+39ZYwHSm77f6SOnQyH2a3Zfq2iBJ9/YaEz634hMtsfwDuSDHIuYJl2T8zTGBA6Xf W+aIFcqtk1CpIXbeDDfmd8FsVFydbUoCkOk5Yrnl7K9ATQdqKIneAAnEdfgvOLMibM7VKk gYMWMIiKgDRJro++R2G0H1MumwSJ97Nvocx0OiQ+z9kjQryedpkYSTB4Rl8v2g== 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=1709711448; 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=lDkqyFKrLOaYCTs5H3/YAly7qBAEVVtReDFlYzPU5NM=; b=S0SiVXNbNu0SU3wydf2CqcmuWhq+IYkVCjCf1rpcddVoT6uJN8Ehf+Zy5dxbpHk+yC3E0s llzOZXllt30cKYME0lHZuJt6rfoO77k2K7TkGe06QETbYFOdIUDEhhVtZoyN2wRpooxie6 9k95+TFmNiPg3ze7gsZSNgnD6c6w5e2XjS2XgxbLCWkj79hvpDqxzNCVjzMFTJG7aL0eNm P+2jUXY9lNy27E2Pv8GaLNYfDHQmZ8PoKZlfRmBhLXqng1+dfL7R5asukD6z/7c45/WIxy XTNqZulKTgBUfwwDxmSHHTA8mswECgH1k6zeBNlZrfcwu1tCrKJ7efqxF7DvLQ== 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 4TqPkJ4Hf8zh5X; Wed, 6 Mar 2024 07:50:48 +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 4267omM4054447; Wed, 6 Mar 2024 07:50:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4267omhK054444; Wed, 6 Mar 2024 07:50:48 GMT (envelope-from git) Date: Wed, 6 Mar 2024 07:50:48 GMT Message-Id: <202403060750.4267omhK054444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2ce23b1f7672 - main - libc posix_spawn(): explain why rtld can be used after fork List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 2ce23b1f76721e44646fc98ba4e24a113a6d5972 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2ce23b1f76721e44646fc98ba4e24a113a6d5972 commit 2ce23b1f76721e44646fc98ba4e24a113a6d5972 Author: Konstantin Belousov AuthorDate: 2024-03-06 07:24:22 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-06 07:25:14 +0000 libc posix_spawn(): explain why rtld can be used after fork Sponsored by: The FreeBSD Foundation MFC after: 1 week --- 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 /*