From nobody Tue Jan 18 01:44:29 2022 X-Original-To: bugs@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 1A1F8196CB8A for ; Tue, 18 Jan 2022 01:44:30 +0000 (UTC) (envelope-from bugzilla-noreply@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 4JdBQj380Kz4fFp for ; Tue, 18 Jan 2022 01:44:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 3FE8418372 for ; Tue, 18 Jan 2022 01:44:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 20I1iTZF037004 for ; Tue, 18 Jan 2022 01:44:29 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20I1iTlm037003 for bugs@FreeBSD.org; Tue, 18 Jan 2022 01:44:29 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259071] Read past EoF in NFS client and fusefs Date: Tue, 18 Jan 2022 01:44:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: mfc-stable13+ mfc-stable12+ X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642470269; 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: in-reply-to:in-reply-to:references:references; bh=kx+4/pr36WnTUP6moswIFsNuDA/I0td0OsRndUhU4dw=; b=UHJc6y44am7M0bmeaRdKtUYPjFjuJGa1RMVYBfJsBFvRRjV3VRD9bo8G2Bjt1NAyN+D7IY yPnm/1UVt+PSBJzA+Nl4WT1ZzqoQNXHMO74gxlcMhcVNijZR5Jnp/DMn4LgqIoK+oeui8q uG5ZpWdbDzCUpZROmPWO5jlnut8geeGW/PxJvPpimBwxhhX3VlCyBo+HUEa8oVB0g+xbm9 Olk5Hab2Rau8uRxY3acLO49E49hfwjg9Zu7FVXnPnsOHwrSx8FfZVjr4qd6G4JAWw7T7Y/ RHY1rKBrzWO7PrdRhRyMdbuIEH8YBXLjMG6JDvZy142Ef9kDG27kjnDpzoXBCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642470269; a=rsa-sha256; cv=none; b=SOLEaiw9VG/Syk640AHeRQES3mQEWU2Uo1eaQLdAbkmubDr0kvcaMV2lUCxOtFASq0t10k Gunu5kn9M1SEJFDfozxshDbwYDD1SBuaIBMhTyCo9jNc5R8/fPVeS8P9F4WQMh21WTTFAe VZmVy2d9EQ7HwzDcKizoFsATRohEG2EL/mKRbRFnzgaq6KJAUKw5spvsN9fkv2fLhUQ0ov RhcR28sMNsaTZwBNH9FPuQN68ShgBU+/QcM/s8iKR95rXd3ZCwdI30a+xT0YnIM6Ibhl2V Xa5XdwoJtw6U6UzieyevP3X8UeD4ctcarvfxhgaP2w9U618OiGh4+IjKA5hmcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259071 --- Comment #24 from commit-hook@FreeBSD.org --- A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3Dc85846ea3ea531affb80edb2c982017d3= 5b5a40f commit c85846ea3ea531affb80edb2c982017d35b5a40f Author: Alan Somers AuthorDate: 2021-11-29 02:17:34 +0000 Commit: Alan Somers CommitDate: 2022-01-18 01:23:34 +0000 Fix a race in fusefs that can corrupt a file's size. VOPs like VOP_SETATTR can change a file's size, with the vnode exclusively locked. But VOPs like VOP_LOOKUP look up the file size from the server without the vnode locked. So a race is possible. For example: 1) One thread calls VOP_SETATTR to truncate a file. It locks the vnode and sends FUSE_SETATTR to the server. 2) A second thread calls VOP_LOOKUP and fetches the file's attributes f= rom the server. Then it blocks trying to acquire the vnode lock. 3) FUSE_SETATTR returns and the first thread releases the vnode lock. 4) The second thread acquires the vnode lock and caches the file's attributes, which are now out-of-date. Fix this race by recording a timestamp in the vnode of the last time that its filesize was modified. Check that timestamp during VOP_LOOKUP and VFS_VGET. If it's newer than the time at which FUSE_LOOKUP was issued to the server, ignore the attributes returned by FUSE_LOOKUP. PR: 259071 Reported by: Agata Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D33158 (cherry picked from commit 13d593a5b060cf7be40acfa2ca9dc9e0e2339a31) sys/fs/fuse/fuse_internal.c | 5 + sys/fs/fuse/fuse_io.c | 5 +- sys/fs/fuse/fuse_node.c | 5 +- sys/fs/fuse/fuse_node.h | 6 + sys/fs/fuse/fuse_vfsops.c | 13 +- sys/fs/fuse/fuse_vnops.c | 15 +- tests/sys/fs/fusefs/Makefile | 1 + tests/sys/fs/fusefs/last_local_modify.cc (new) | 423 +++++++++++++++++++++= ++++ 8 files changed, 466 insertions(+), 7 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=