On Tue, Jul 16, 2019 at 02:04:12PM +0200, Silamael wrote:
> We found a problem with programs using unveil() executed by chroot in a
> mounted file system.
> After the program run, umount of the file system will return with EBUSY.

If I understand the code in ufs_lookup() correctly, *vpp = tdp is
refcounted in the ISDOTDOT case.  This happens also if *vpp == vdp.

So it is wrong to skip dereferencing if parent != vp.  I have written
a test and this diff survived a full make regress run.

ok?

bluhm

Index: kern/kern_unveil.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_unveil.c,v
retrieving revision 1.29
diff -u -p -r1.29 kern_unveil.c
--- kern/kern_unveil.c  29 Jul 2019 23:14:06 -0000      1.29
+++ kern/kern_unveil.c  30 Jul 2019 12:18:52 -0000
@@ -309,8 +309,7 @@ unveil_find_cover(struct vnode *dp, stru
                        break;
                }

-               if (parent != vp)
-                       vrele(vp);
+               vrele(vp);
                (void) unveil_lookup(parent, p, &ret);
                vput(parent);

Reply via email to