From nobody Thu Dec 28 03:11:17 2023 X-Original-To: dev-commits-src-all@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 4T0tnd70tFz552f4; Thu, 28 Dec 2023 03:11:17 +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 4T0tnd5cRlz3bKm; Thu, 28 Dec 2023 03:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703733077; 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=QgFSi+7YEzrH7zXfSoIr8LDasOantmSHDgU763ESLX4=; b=tSHue8/RZDnCHuS0LKsBoF0GU4dXnl4cPrhQY2s3XQ7TwmZNL+eE2y9jZOdFSZnMU83iYJ tdGw0oQjZ55MoznVbmsWdZR4ra8RyAiXUjB/ux5j2bKFJegBRXvG8Z5RfVING/04YdWVib xmhu/6kHci3qtCbT+7WcQUiXe/Hcvn88W/qDvZhJ/ZdloPTH+ZCsGM+aSpmxDAgCmQnXHi t1ghcyL12P7/pflvep4eDZsO8gbciD0Qj2QUL+Qsg2Jk8SEiRs42GJ1ZYR3QILehoOwKNy P0P0h7sdNCHIsa26KcDtTNwpZCoSEXuOqlSH1r/coLESxMM0OdIq+IKFmwzkbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703733077; a=rsa-sha256; cv=none; b=NCWj3M2RbZCWGskrd7xjgvjWtj1ddpLGVJ8k6TBhXAODWwxeVO3QNwPVz3INgo74PPCyTr A5YPh8UuAorvyK+lCbCZ5K4v1moLJirngOKXv/5DTOPcn/OKb5PnaRfq+3Ym26eNYscD0L URdVObDGSqjETUKr/q49ibTXqX6UYY/bmMgEp0w/IxQuZIgX2HZJjCCbFxo89sdxkM5BE3 J+QnAKdRVvqI5xra7/2rdsCP15oltNaEn05w67PnH4iBQpd5CKUH+4ovYhkmT4wLdlgZZH t+efe4bcZByT4QoDLEoBka3ZOFRXFpB/5scHUFEXEyAUiSfUVIAekLOjD7x5LA== 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=1703733077; 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=QgFSi+7YEzrH7zXfSoIr8LDasOantmSHDgU763ESLX4=; b=PN5NZfSLODnNjlU4HGEg25SjqyzbiMfOT8hk9UF0zLVNiaEU/YfbRF5ehHLMuCjIeYhtFv l6txccJ+hvcQssbdlKbuA7ihXC6X5rRY9RAFSfJ8kWaZVN/XtGKd9DD8mgGfdUjk2tmsrO +ZXWn4rwDX3xUmnV/5aD5q9F/vv8zwUcTM9DHJngtuJEobwln1M2QIxnfuqmISN1yreLZy eTiKXA+GLzOByZhB+/HI9R6tR4LUl/jSZhpj9yeais6TcRb1QRAJaqPtfTcLItVxlUxP7K WbvRcpKyPa2hJFoS3UNLzKv44UFJmZHY4nqQGoQMZnWyKUunTUsmfrUL4bbnvw== 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 4T0tnd3dCtz15Kk; Thu, 28 Dec 2023 03:11:17 +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 3BS3BHtO053217; Thu, 28 Dec 2023 03:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS3BHgZ053214; Thu, 28 Dec 2023 03:11:17 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:11:17 GMT Message-Id: <202312280311.3BS3BHgZ053214@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: b525eaaa4aaf - stable/13 - ufs: Update *eofflag upon a read of an unlinked directory List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/13 X-Git-Reftype: branch X-Git-Commit: b525eaaa4aafeee857d1abef27d7ddf1af76846f Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b525eaaa4aafeee857d1abef27d7ddf1af76846f commit b525eaaa4aafeee857d1abef27d7ddf1af76846f Author: Mark Johnston AuthorDate: 2023-12-21 18:26:13 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 03:04:22 +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 949e7bcc1bec..954f85e17a9f 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2434,8 +2434,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;