From owner-svn-src-all@freebsd.org Tue May 19 15:23:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E52A12DB9D6; Tue, 19 May 2020 15:23:39 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49RKQz1l08z3RRY; Tue, 19 May 2020 15:23:38 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 04JFNULQ006637; Tue, 19 May 2020 08:23:30 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 04JFNTdn006636; Tue, 19 May 2020 08:23:29 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202005191523.04JFNTdn006636@gndrsh.dnsmgr.net> Subject: Re: svn commit: r361238 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs In-Reply-To: <202005190241.04J2f54E001347@repo.freebsd.org> To: Kyle Evans Date: Tue, 19 May 2020 08:23:29 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49RKQz1l08z3RRY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 May 2020 15:23:40 -0000 > Author: kevans > Date: Tue May 19 02:41:05 2020 > New Revision: 361238 > URL: https://svnweb.freebsd.org/changeset/base/361238 > > Log: > zfs: reject read(2) of a dirfd with EISDIR > > This is independent of the recently-discussed global change, which is still > in review/discussion stage. > > This is effectively a measure for consistency in the ZFS world, where > FreeBSD was the only platform (as far as I could find) that allowed this. > What ZFS exposes is decidedly not useful for any real purposes, to > paraphrase (hopefully faithfully) jhb's findings when exploring this: > > The size of a directory in ZFS is the number of directory entries within. > When reading a directory, you would instead get the leading part of its raw > contents; the amount you get being dictated by the "size," i.e. number of > directory entries. There's decidedly (luckily) no stack disclosure happening > here, though the behavior is bizarre and almost certainly a historical > accident. > > This change has already been upstreamed to OpenZFS. Until the grep -d skip issue is addressed I object to this change as it is going to cause people who do grep with wildcards to see lots of errors that before where pretty much either silent (no match occured) or spit out a "binary file foo matches." > > MFC after: 1 week Please no. > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 19 02:07:08 2020 (r361237) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 19 02:41:05 2020 (r361238) > @@ -646,6 +646,12 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t * > ZFS_ENTER(zfsvfs); > ZFS_VERIFY_ZP(zp); > > + /* We don't copy out anything useful for directories. */ > + if (vp->v_type == VDIR) { > + ZFS_EXIT(zfsvfs); > + return (SET_ERROR(EISDIR)); > + } > + > if (zp->z_pflags & ZFS_AV_QUARANTINED) { > ZFS_EXIT(zfsvfs); > return (SET_ERROR(EACCES)); > -- Rod Grimes rgrimes@freebsd.org