From nobody Mon Mar 11 00:30:36 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 4TtHk50Djbz5DDXQ; Mon, 11 Mar 2024 00:30:37 +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 4TtHk43BGGz4v01; Mon, 11 Mar 2024 00:30:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710117036; 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=BmL29skH24JotQgGoJl9RjumDg+RyZJQb1Ch8rquBbA=; b=fX0duFRzM8tpSUScWcukcxTNOQfT2WVv5WZWwv326qhB85kjnxx9KEnkfHH1ZZFoTjmjjG Ermowk4Lb52xyVBTj8hsnDA0QbKjXTjIY7qucIHCZnZ1de4htkrBe33LCPKd/A9+VTnO/4 fcZa0VVwKC0tWWurZQl2xknPYj8FGfwvjfyaAyBWlMzhwWUKkpmr3r33EUYwUHQMGeU7Pg RZxQpa1kFVYf2An+IUB7JmArFSnQlBDQo0WUUtcnOUEZ0CSwpJAEdJo0mcN3jZLXyDEV2e 3JON88cRxoF5P2g+ORLXNOsuWj50NM1B5c65FkCA8t1/ieJFmG2+S3fyJkXWHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710117036; a=rsa-sha256; cv=none; b=HIcfBHN6yox6UK47jeliql9jXTdKAkuAAfhRzlVv8uC2ZC1sB6uvXsBa7wZzmy5JALdVml 8dT65H7pnVdQ5bOR/HEkCrX4LyYi5RREg7pc8zR/70AAkJk5vnQ57lMwB/OvQMRzl5TSLO qQT5F+BPVbi3UDx/MSDnwyJ9M7bgsYs5Yd4fDBOLj2isOEJn9xZA4j7rlId1Q7a9ROYIvr yaPFansqddNaorxirDhKmLWti7WLmjuICBE3k33KsDmJBoQ/BK6DZ6zuWAhoB3G6+F0NVO Esq2G3RYpY4HBT0ca/9pAHLh82mLmSj7S8zJQZZTittoqZ7jaJPmfmC6/YJUvg== 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=1710117036; 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=BmL29skH24JotQgGoJl9RjumDg+RyZJQb1Ch8rquBbA=; b=b7TBXCREWqxOHK1ACDjZ1mYr2d13Kk7QKdAJLI9EtlRpEkbhQpqK+xcF9+mKAn+5ipPjTV h8apu7dzS0ccySmqABEvKGGDpLkMSXtsHW8Ob4m0wEnaSbpfL6kW1QwVsUBUYHT3IfHMbJ ZafwDcnU7vOfrcKfy8MbnubqaERURKqX9PmS9nG1VzP6Zvcqx963c+3OXPCvsvnezpld3i vAErRoAySKG+hE1Htw33dVMdQS0mf5MEcGvGGKzAQNhvWiK6ArNzJafWncfcjupvQIS5Td OXbF2iNcLdKbEzWrq0wqSRCFVu0Yz+ybetJ++dbBVJlEXfu3SulsKqrh1tpxNw== 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 4TtHk42KdCz16sd; Mon, 11 Mar 2024 00:30:36 +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 42B0UavI003175; Mon, 11 Mar 2024 00:30:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42B0UarT003172; Mon, 11 Mar 2024 00:30:36 GMT (envelope-from git) Date: Mon, 11 Mar 2024 00:30:36 GMT Message-Id: <202403110030.42B0UarT003172@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: c4e18a7ba35e - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c4e18a7ba35e663d6d0765545ab6fd8377c55366 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c4e18a7ba35e663d6d0765545ab6fd8377c55366 commit c4e18a7ba35e663d6d0765545ab6fd8377c55366 Author: Konstantin Belousov AuthorDate: 2024-03-06 07:24:22 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-11 00:29:51 +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 67e6e3a19876..064bae186876 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -326,6 +326,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 /*