git: 40d0ff39eb56 - stable/15 - cap_enter.2: document new behavior, in particular EBUSY

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 11 Nov 2026 01:07:04 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=40d0ff39eb563b81dadecaa864fbfb4b51b12085

commit 40d0ff39eb563b81dadecaa864fbfb4b51b12085
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-21 23:18:36 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-10 19:53:57 +0000

    cap_enter.2: document new behavior, in particular EBUSY
    
    (cherry picked from commit 82bbfe16ae1eaa9eca970cb50abe8ac9162fe9cb)
---
 lib/libsys/cap_enter.2 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lib/libsys/cap_enter.2 b/lib/libsys/cap_enter.2
index 90c089ae9b07..d1248d4d8b8f 100644
--- a/lib/libsys/cap_enter.2
+++ b/lib/libsys/cap_enter.2
@@ -64,6 +64,10 @@ When combined with
 may be used to create kernel-enforced sandboxes in which
 appropriately-crafted applications or application components may be run.
 .Pp
+Other threads are stopped while the call runs, so some of their
+interrupted system calls may return
+.Er EINTR .
+.Pp
 .Fn cap_getmode
 returns a flag indicating whether or not the process is in a capability mode
 sandbox.
@@ -116,6 +120,18 @@ The running kernel was compiled without
 .El
 .Pp
 The
+.Fn cap_enter
+system call may also return the following error:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+The file descriptor table or the current/root directory state of the
+process is shared with another process, see
+.Xr rfork 2 .
+Sharing would allow the other process to grant additional privileges
+to the process after it entered capability mode, without its consent.
+.El
+.Pp
+The
 .Fn cap_getmode
 system call may also return the following error:
 .Bl -tag -width Er