Hi,

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.

Simple test program to reproduce the problem:

---------------------------------------------
#include <unistd.h>
#include <err.h>

int main() {
        if (unveil("/", "") == -1)
                err(1, "Error calling unveil()");

        return 0
}
----------------------------------------------

Steps to reproduce:
1. Mount a MFS to /mnt
2. Compile the example program with -static and copy to /mnt
3. Do a chroot /mnt unveil
4. Try to unmount: umount /mnt

The umount command will fail at least with OpenBSD 6.5 and -current with EBUSY. I haven't tested if the error also exists in 6.4. As far as we found out, the use counter of the vnode for the directory seems leaking.

-- Matthias

Reply via email to