O_PATH: disable kqfilter for fifos

Filter on fifos is real filter for the object, and not a filesystem
events filter like EVFILT_VNODE.

Reported by:	markj using syzkaller
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2021-04-28 18:45:36 +03:00
parent 72a42ec63b
commit 2082565798

View File

@ -427,7 +427,10 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred,
return (error);
}
if ((fmode & O_PATH) != 0) {
error = VOP_ACCESS(vp, VREAD, cred, td);
if (vp->v_type == VFIFO)
error = EPIPE;
else
error = VOP_ACCESS(vp, VREAD, cred, td);
if (error == 0)
fp->f_flag |= FKQALLOWED;
return (0);