[Bug 280809] jail_attach(2) fails to document reason for EPERM

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 13 Aug 2024 20:23:24 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280809

            Bug ID: 280809
           Summary: jail_attach(2) fails to document reason for EPERM
           Product: Documentation
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Manual Pages
          Assignee: bugs@FreeBSD.org
          Reporter: karlo98.m@gmail.com
                CC: doc@FreeBSD.org

Created attachment 252746
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=252746&action=edit
Documents this behavior in lib/libc/sys/jail.2

In jail_attach(2) the only reason listed for EPERM is if the user not root
while attempting to attach to a jail.
Running into that errno in my program I was puzzled because uid was 0 - so that
could not have been the problem.
After help from other people I found out that there might be other,
undocumented, reasons for getting that errno.

Specifically, the issue was that the process was holding a directory FD open
while trying to attach, which is prohibited.

A sentence describing this behavior should be added to "[EPERM]" in
jail_attach(2) "ERRORS" section.

-- 
You are receiving this mail because:
You are the assignee for the bug.