From nobody Tue Jul 04 23:09:26 2023 X-Original-To: bugs@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 4Qwdlp71kTz4lgLg for ; Tue, 4 Jul 2023 23:09:26 +0000 (UTC) (envelope-from bugzilla-noreply@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 4Qwdlp1gTFz3Gm1 for ; Tue, 4 Jul 2023 23:09:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688512166; 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: in-reply-to:in-reply-to:references:references; bh=i0gexRWZfHydXT/XirYFiuhJLdRlv12uj+u+LVQOWPw=; b=QrCrtEN+SBAhK8KuHG/mJwM1rGaDLYziZih9tAdQopstAx4AVJdaWTsfJQyvfGPhLsT1qe dQAJG5c+j/EqOvXCz63n9bgWuH4xnZ0R6NZRsksCkSid4DmTTRW1+ttzdwtR0EnDRA7Z3h 8o8JNWlVj88ZZc11DMPT5egD3qyHAqBCP6iaUmEVoLNVVQcz6tXgjb4qzj27iUFvtocwsn FWBqysw+Pgggvy3P/wjC9mhF3v4pwbcHgVN0yx+QOy/Ovf8lfC3nUmbEbBiiASmQIf+5II 6PilvadTvczOQHiFrSZ64RNvuigm/E0C81FxXVm921AS8voOQ/pR/liSj38p6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688512166; a=rsa-sha256; cv=none; b=ATBkS2CGfFFQnSfaoHMh9ewAkJNPY8LhnkNCxI27h1FBIk2CwAfMRg4rPAF9z/f8eMAUQT zwGcLS6Lke2nvtQiWkj70gE8GhYG1JzwLMBwANGT4MMLEJ7KjfoJOsIxsrpB4m0+3UQ5Ob Xw8IEaWcfCcnqRJ4I8l18Ic8be9lg/ovwz+Yk7NeDsD8K4YpjH0sVnQWO9BcCV8jSZ3qr1 gtftGcDlAvPlf9+1+PxvK0CVkoBL/7DY3cTMfh+Uks2AwFA7wmGME7MYQHxrPLcH7h31lN HIfkG1HIYgREqBGKiUHvbHtquMUxM5QgSK0FPlY1hBnRlgnfEs5OWLYEM+Iczw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4Qwdlp0mX2zrZl for ; Tue, 4 Jul 2023 23:09:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 364N9Qq8085529 for ; Tue, 4 Jul 2023 23:09:26 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 364N9Qjt085528 for bugs@FreeBSD.org; Tue, 4 Jul 2023 23:09:26 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272367] openat(..., O_NONBLOCK | O_EXLOCK) may wrongly return EAGAIN Date: Tue, 04 Jul 2023 23:09:26 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272367 --- Comment #2 from Konstantin Belousov --- Several preliminary facts: 1. posix_spawn is basically vfork + exec. 2. vfork does not stop other threads in the forked process 3. vfork copies file descriptor table, creating additional ref for each file 4. flock semantic is that the lock is dropped only on last close So what could happen in your program is that some thread A has opened and locked its file. while thread B called posix_spawn(). Forked child now shares the reference to the file of thread A. Thread A closes the file and tries to open it again, which would block on the old lock still existing due to ref in the child of the thread B. That's it. --=20 You are receiving this mail because: You are the assignee for the bug.=