On Tue, Jul 16, 2019 at 02:34:52PM +0200, Klemens Nanni wrote:
> Rebased diff after bluhm's conflicting realpath/POSIX fix.

I have seen a similar problem with immuatble chflags(2).

# rm /etc/hosts
# chflags uchg /etc
# ifconfig vio0
ifconfig: unveil: Operation not permitted

Adding EPERM to the list of exceptions also fixes this.

There is a typo in the diff: outselves -> ourselves

OK bluhm@

> Index: kern/vfs_lookup.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/vfs_lookup.c,v
> retrieving revision 1.79
> diff -u -p -r1.79 vfs_lookup.c
> --- kern/vfs_lookup.c 15 Jul 2019 14:56:45 -0000      1.79
> +++ kern/vfs_lookup.c 16 Jul 2019 12:34:36 -0000
> @@ -577,10 +577,11 @@ dirloop:
>               printf("not found\n");
>  #endif
>               /*
> -              * Allow for unveiling a file in a directory where we
> -              * don't have access to create it ourselves
> +              * Allow for unveiling a file in a directory which we cannot
> +              * create outselves.
>                */
> -             if (ndp->ni_pledge == PLEDGE_UNVEIL && error == EACCES)
> +             if (ndp->ni_pledge == PLEDGE_UNVEIL &&
> +                 (error == EACCES || error == EROFS))
>                       error = EJUSTRETURN;
>
>               if (error != EJUSTRETURN)

Reply via email to