From nobody Tue May 07 20:02:40 2024 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 4VYq2C6gRpz5JYyj for ; Tue, 07 May 2024 20:02:43 +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 4VYq2C3SXdz50g4 for ; Tue, 7 May 2024 20:02:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715112163; a=rsa-sha256; cv=none; b=sooAqiGn4gqQ2gMEvhBvnLes8Kr760+VtycMfS1EIdd+wu7nPKBRQ34aUJhd8c7MKuptdo LI+koGJjd7LjXgaqs0QuXg+VbgQuB89Or5F99qCMFcXQdZVFaIlXjjlugEkxfxFCyuUN/W OSKNPzK1CdLK0LTDZlkpzXay2wa2ssZ0cbFI18WetC8xusQdpCzOSxW1sfty+wUfCu1DM8 iwnPhtmbxbyW7F0C6dnK18cBm50MfeIKgnCAaidzDrKZXetCGa845RnRvsm5AD19f9QUfU V3Ll5Q2UFGMqjSeuTg4KqdPRniCQj8+sEbEdK7dWHA8SxMt4QePJm7o6YTTTxw== 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=1715112163; 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=GhJNmAsMPXHOzjWXPNAEqJxRu/BiTCEJ8glVUo7Us6s=; b=C+S29CTXtfSWikcFTcr+JHCdYT21/ENjYuDOQKQe4kYaPYIksQyYLm16MjH7GQDAA1XYuS aCAJki6kZZRveXR2HXxhXKIFUw+0W0CMj0STPJ2Xt6pWttGujrnMbFw6Zgrr5pLXoSJMZE O99VL4Kj2RGGshv+Iz96lgWNkKoJhmvWtw5JlGrx/XE3HfXMZ+eKJAqBqy1NNZ8SyhndKn qqMRFVCVPmFtXDjXh5TE3G+Kmft18kV5ukfjriMH0B/yaarRgojbg2xBoimnCh94ceR5Ef Pr1oWbVsTeIAJCpKmS/J39rF8U2jk0Nrzt3lYjXJWFqCqjej70R40sv9Ui2oqA== 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 4VYq2C352Hzvc5 for ; Tue, 7 May 2024 20:02:43 +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 447K2hWa068767 for ; Tue, 7 May 2024 20:02:43 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 447K2h5X068750 for bugs@FreeBSD.org; Tue, 7 May 2024 20:02:43 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 278841] rfork(2) bad documentation Date: Tue, 07 May 2024 20:02:40 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Documentation X-Bugzilla-Component: Manual Pages X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: i+freebsd@1a-insec.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278841 Bug ID: 278841 Summary: rfork(2) bad documentation Product: Documentation Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Manual Pages Assignee: bugs@FreeBSD.org Reporter: i+freebsd@1a-insec.net CC: doc@FreeBSD.org # problems about rfork(2) rfork(RFTHREAD) returns 0 (but it doesn't do anything). This is not documen= ted explicitly. RETURN VALUES section bad >>> start (this part should be in RETURN VALUES) If RFPROC is set, the value returned in the parent process is the proc= ess id of the child process; the value returned in the child is zero. Without RFPROC, the return value is zero. Process id's range from 1 to the maximum integer (int) value. The rfork() system call will sleep, = if necessary, until required process resources are available. >>> end The fork() system call can be implemented as a call to rfork(RFFDG | RFPROC) but is not for backwards compatibility. RETURN VALUES Upon successful completion, rfork() returns a value of 0 to the child process and returns the process ID of the child process to the parent process. Otherwise, a value of -1 is returned to the parent process, = no child process is created, and the global variable errno is set to indicate the error. I don't understand this wording: > RFTHREAD If set, the new process shares file descriptor to process le= aders table with its parent=20 Since `man -K 'process leader'` gives no result, I've read the FreeBSD sour= ce code and wrote about p_leader myself: https://www.1a-insec.net/frag/35-freebsd-fd-race/. I hope I understand this correctly. For some reason, there are both `proc->p_fdtol->fdl_leader` and `proc->p_leader`. In sys/kern/kern_descrip.c, I see: error =3D VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_S= ETLK, flp, flg); (void) VOP_ADVLOCK(vp, (caddr_t)fdtol->fdl_leader, F_UNLCK, &l= f, F_POSIX); What is happening here? --=20 You are receiving this mail because: You are the assignee for the bug.=