[Bug 252673] Read on a SEQPACKET AF_UNIX socket returns the wrong error when disallowed by Capsicum

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jan 14 15:07:42 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252673

            Bug ID: 252673
           Summary: Read on a SEQPACKET AF_UNIX socket returns the wrong
                    error when disallowed by Capsicum
           Product: Base System
           Version: 12.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: theraven at FreeBSD.org

A socket is created with:

```
socketpair(AF_UNIX, SOCK_SEQPACKET, 0, socks);
```

And then restricted with:

```
cap_rights_t rights;
cap_rights_limit(fd, cap_rights_init(&rights, CAP_WRITE));
```

When passed to the `read` system call, it fails (as it should) but returns
`ENOENT`.  This is not a documented error value for `read`.  I believe the
correct return value is `ENOTCAPABLE` (which is also not a documented return
value for read, but would have immediately told me what the problem was).

I have not validated whether different kinds of socket have the same behaviour.

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


More information about the freebsd-bugs mailing list