From nobody Thu Dec 21 18:27:18 2023 X-Original-To: dev-commits-src-main@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 4SwzRq22Tzz555RB; Thu, 21 Dec 2023 18:27:19 +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 4SwzRq1bGcz3ZY1; Thu, 21 Dec 2023 18:27:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703183239; 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=XDu1DZjE5fZ2WWKe5TnBMieDVgwbxCgOWjKKIs3FV9Q=; b=g18OcgjW/XXPtv3i4T+EyTTt7Jxa6mg/Mo8w34TU8cMyG7fDMvmmi74r4QDq0Dd0Z9D/Ee lP0VMpuA0wlAXnrNOR0YgWAsLEjoYniDQJlHMLzSP0mF/UJNKw1rgvUseRX+SM8ayoljvy eaH+/2TPxwXxyFPbKYngXj0FaGYYC04W8JAM/HXwBZmY3n9l4xxJJo35Gt4psgoR2JxL6u pqV+NG0cPAZ7a/xz9/xEl/A/4QqCsZO3/OVpI43G85Tuo2kH5d6b0iJdpY1014+P+S1lbV OFIOV90yI8vfa8tLOF2aeRrUWTUWnqhafxxiZCBLIai+rdU2ofpl9IkWTaIIHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703183239; a=rsa-sha256; cv=none; b=crPoY1+qBuTNKuBChZpucXRWfuUKNDWH4v7Rvw+HsUOLLxgL1WCSfMUADb/LOtY5YMZGLj FW8w0pTJ6+K1gxdDmY7UrqEXF+Qfhbcq3L1fR7rIUar9Sfqm/Dx96nmMXTUL+KqWRmGUNc fo63aBwdCwnkWhXC9MW99ADhnvBdVUqjxsgiWrf03ptLWhULGn4hHSexAoWuV+v84ddh7g an41gtZ9IbFm+kXlRyjU7PQdTWAz+5sIvmu5dr+t0GE5YnNOmcH/GITLELemRjNqUERZQV BfH6ZZJRUl+JECAzsba0Y0oei++/G+mP1eQj3USGbsuoLvO1MP4J3LYQN8v4zQ== 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=1703183239; 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=XDu1DZjE5fZ2WWKe5TnBMieDVgwbxCgOWjKKIs3FV9Q=; b=qCqWJU4KVoXhNTLPjuAiMGa2BvP1czOIGQyUylWFBPFy/xGg8pVoCtCTBRMrRpVXNZDfRn YhTM4mQJ8Glops6/BPsg3bMqHu6ib6GVPiZJvjbUObQCy5bbNg6VMSY9K+X/Clr8b1kSix TtMChP4KjrcjJp1LjZ2qFPEvC5Aav0/B5RaZfjI8AUTAu7g9UGdr+uPPBU+RUho46QitU0 B0hdLg9K/lONnPnk5qfRNaS33ppTni24V+5xPU6a9q2ChkdFvf+sPYQ1rdydgRjLGSIUHB qgGUMMx3fpq4bKkZqgdt0Hzo+HK9QlQvzcXB1NulIEkJyXr8A5Y4jGbNylg5Sg== 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 4SwzRq0Xl7zk0D; Thu, 21 Dec 2023 18:27:19 +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 3BLIRIsa050572; Thu, 21 Dec 2023 18:27:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BLIRI9d050569; Thu, 21 Dec 2023 18:27:18 GMT (envelope-from git) Date: Thu, 21 Dec 2023 18:27:18 GMT Message-Id: <202312211827.3BLIRI9d050569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3ff574c5e1d1 - main - ufs: Update *eofflag upon a read of an unlinked directory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3ff574c5e1d1d5d07763a14f22d6f9d7291550c6 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff574c5e1d1d5d07763a14f22d6f9d7291550c6 commit 3ff574c5e1d1d5d07763a14f22d6f9d7291550c6 Author: Mark Johnston AuthorDate: 2023-12-21 18:26:13 +0000 Commit: Mark Johnston CommitDate: 2023-12-21 18:26:46 +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 --- 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 3bfa2019739a..c62583afaab6 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2417,8 +2417,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;