From nobody Thu Dec 28 03:01:06 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0tYt6VDGz551fg; Thu, 28 Dec 2023 03:01:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0tYt5KNSz3YkB; Thu, 28 Dec 2023 03:01:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703732466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gnyDhiHEaoOLzhIVvxJg2yTj/NKPTKwyqCQ5h8AP398=; b=Na70VKXu6A9Po9FSuxajuU9k6yTdCVl6riiBSnj2pfPYc14IHO+6d1wVqWqNxCm5JqM96e vOXyAGABxonYB//ocWTi6lXCIY3BR0mCZPDmheITsRX8PvEUoDR6nTQPnGA11faCHZuvym Mnaw6JB96h0PJHu4vvsoPj8KN/9X/hms+vydf9PJmi9SwL3SNPfc0G1ghyI4pDbr2QvnFr Sskv+OB9y0Xy1aFuMp1v0/vJmYwmJhnAJDY5fqOMROm/hUv+tKrcMH6Tp2xTnLWTceIn1T LWzPApXot+gWRVrH8jpfNc2ZGkjWxxZfvqzwc6rEqJ/IFGdLFDQjuYfRdQharw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703732466; a=rsa-sha256; cv=none; b=q5RNsIAd5hH/kzZkDfJWR1QYxmuzIYgaeLDW57BsLrYMugxebHdN6OiEEiqgQPhDJzsK3+ +dqD9M+DiP0JiN+Ea9IP8j3DP4IqeJwYiqkLXCs1GbVXmC/n+KLw/1veeCbnVNO2jI8K1B /rCzW6f8X4vVtALA9XHfQv6Nsf456S3KkPpE6RtNjW2KfCXQj6a28b1SGXaVi5X+zB/A1S K4cTfW4hsSZvPvFzhW76UPEtzE+/diIgHNdzwNpcLzN5FvBKZ+AVes9xRkdzW+vaHyf1jE BZWrI2YGqA/64ptj72ReDtK3nucI3omYl0TnSL+/yBAfn1c2sqe7vqOsW+zLIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703732466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gnyDhiHEaoOLzhIVvxJg2yTj/NKPTKwyqCQ5h8AP398=; b=dAvcIUwfrsX6QlpWv7Bw03ex63biCOH6zhWd3pJJPUIMcnovotXlkG5cMaLw9dk2a00r3n l7aMGsgPkv3C+JQAPH3Dm4TzdXpsYDjX8gHA8ndm950D5Zym4X0zZUhuRL8o5mvJ1WtJEk zem1tb6JqhjTPFZkifDZvh5+tEXmOMIPv1PRdU0K9lvCLUSe3mpr6Xlq38hY8wQO+RYLSL vwhpRKdZjJaZqXdI0XADwxM9L30MVXn8D5Sq3vPv6KMlmzOyT6hzIcM0+ZDOyM9vI6+wLS seRLtMQytfhokW0NXrzGRoXJ2VXZ98CV2VJiSSj0cNFAj4rZDBBvP4lEPrm8Og== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0tYt4Psbz14m4; Thu, 28 Dec 2023 03:01:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BS316Pr035647; Thu, 28 Dec 2023 03:01:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS3168x035643; Thu, 28 Dec 2023 03:01:06 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:01:06 GMT Message-Id: <202312280301.3BS3168x035643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3e36ef48a063 - stable/14 - ufs: Update *eofflag upon a read of an unlinked directory List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3e36ef48a0633271cbb913eee9b2562143db1da0 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e36ef48a0633271cbb913eee9b2562143db1da0 commit 3e36ef48a0633271cbb913eee9b2562143db1da0 Author: Mark Johnston AuthorDate: 2023-12-21 18:26:13 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 02:58:43 +0000 ufs: Update *eofflag upon a read of an unlinked directory If the directory is unlinked, no further entries will be returned, but we return no error. At least one caller (vn_dir_next_dirent()) asserts that a VOP_READDIR call which returns no error and no entries will set *eofflag != 0, so the current behaviour of UFS can trigger an assertion failure. Simply set *eofflag in this scenario. Reviewed by: olce, kib Reported by: syzkaller MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43089 (cherry picked from commit 3ff574c5e1d1d5d07763a14f22d6f9d7291550c6) --- sys/ufs/ufs/ufs_vnops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index ff1f2af7b65b..fcd5e7478cad 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2419,8 +2419,10 @@ ufs_readdir( if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); - if (ip->i_effnlink == 0) + if (ip->i_effnlink == 0) { + *ap->a_eofflag = 1; return (0); + } if (ap->a_ncookies != NULL) { if (uio->uio_resid < 0) ncookies = 0;