NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/56316: vn_open doesn't follow symlinks

Did you notice that zfs has a wrapper zfs_vn_open for vn_open in


static inline int
zfs_vn_open(const char *pnamep, enum uio_seg seg, int filemode, int createmode,
    vnode_t **vpp, enum create crwhy, mode_t umask)
        struct pathbuf *pb;
        int error;

        ASSERT(seg == UIO_SYSSPACE);
        ASSERT((filemode & (FWRITE | FCREAT | FTRUNC | FOFFMAX)) != 0);
        ASSERT(crwhy == CRCREAT);
        ASSERT(umask == 0);


        pb = pathbuf_create(pnamep);
error = vn_open(NULL, pb, 0, filemode, createmode, vpp, NULL, NULL);
        if (error == 0) {
                VOP_UNLOCK(*vpp, 0);
        return (error);

There is is forced.

Removing "filemode |= O_NOFOLLOW;" there makes ZFS opening devices via symlinks again.


On 07/18/21 08:55, Michael van Elst wrote:
The following reply was made to PR kern/56316; it has been noted by GNATS.

From: (Michael van Elst)
Subject: Re: kern/56316: vn_open doesn't follow symlinks
Date: Sun, 18 Jul 2021 06:51:48 -0000 (UTC) (Frank Kardel) writes:
> We should just disable the force setting of O_NOFOLLOW in vnopen and It's not forced. Apparently just in the ZFS case the caller was changed
  to set O_NOFOLLOW and there is confusion on what FOLLOW and NOFOLLOW
  do. In fact, both are and were masked inside vn_open, so the O_NOFOLLOW
  flag is and has been the only relevant (despite what the comment said).

Home | Main Index | Thread Index | Old Index