git: 82bbfe16ae1e - main - cap_enter.2: document new behavior, in particular EBUSY

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 04 Nov 2026 16:23:25 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=82bbfe16ae1eaa9eca970cb50abe8ac9162fe9cb

commit 82bbfe16ae1eaa9eca970cb50abe8ac9162fe9cb
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-21 23:18:36 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-04 16:23:11 +0000

    cap_enter.2: document new behavior, in particular EBUSY
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D60963
---
 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