Hi,

I found a little bug in the unveil(2) error handling.  After blocking
unveil(2) by unveil(NULL, NULL), an additional unveil(2) call sets errno
to EINVAL instead of EPERM as the manpage saids:

EPERM   An attempt to increase permissions was made, or the
        path was not accessible, or unveil was called after
        locking.

bye,
Jan

Index: kern/vfs_syscalls.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.304
diff -u -p -r1.304 vfs_syscalls.c
--- kern/vfs_syscalls.c 20 Aug 2018 16:00:22 -0000      1.304
+++ kern/vfs_syscalls.c 30 Aug 2018 20:04:48 -0000
@@ -899,7 +899,7 @@ sys_unveil(struct proc *p, void *v, regi
        }
 
        if (p->p_p->ps_uvdone != 0)
-               return EINVAL;
+               return EPERM;
 
        error = copyinstr(SCARG(uap, permissions), permissions,
            sizeof(permissions), NULL);

Reply via email to