From nobody Sat Jan 01 00:41:16 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 B2E9619201F2 for ; Sat, 1 Jan 2022 00:41:17 +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 4JQjqd26V6z3HkZ for ; Sat, 1 Jan 2022 00:41:17 +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 21E6115713 for ; Sat, 1 Jan 2022 00:41:17 +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 2010fHbg062809 for ; Sat, 1 Jan 2022 00:41:17 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2010fHq5062808 for bugs@FreeBSD.org; Sat, 1 Jan 2022 00:41:17 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: Sat, 01 Jan 2022 00:41:16 +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: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: 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=1640997677; 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=urxPl4WJ3S3Vsqcx9iCYs6yHU8Nu0c0ypMvqDIWegc0=; b=C/9AMhw/u4lDDWKQya7RQgjRh866TE4B6jbedfiSvaI9nxSBHMTslyALXGXZL8rEbE0cjN vjvoozNkjW/KsBv38CoL5hN6mqUY/qbWzy/vKzJO7RAr1CJx6FMfybVEQ6muKucFViNK2c oP8+B5F/72EvLeMSiqkmaCqHI1rBqZtHKjKs/IuagKMlkRmx1KJ1uxfNt/X+BMx8Byg2Ry 5kBdJ2/SHxidZx3Pnjpyl3kSMRpLm0iWN16MzS9yAy8tsmTY/zrOg+DFAsAPm3GUq58A6O pJ1m4WCv7vN2Wzdue/2kev5DZU0D9msrm4zWeU5OD4cZiTo8BywSISH80wAtqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640997677; a=rsa-sha256; cv=none; b=aTtjQ3oj7Cl+BTCQXvlbIdrX7XBdbl1M37QkZz2r3fykD111Pe1fRX8MP3eXh31KFzLNbx ryfR1vw3NEbn4lhUf9jSTkAcWjVaCG5hgOEM0ER+kBw7o1X5QRDdGiJdAm1qsyR3u3OXch Rjf/WXhv8zxV7gW2h121Ey/h6LI0YgIY8f3HrmU3nGl5vO4zj08wkKSuXXrrwk532q+WRu ZnfjYQeXRyCfJktXgxATWST01fVHadD+sxamIm/foh4ZAlSveYeJ3chGj4eBYECyk7yyFr BlQ6QSZbB33pheWtNKijRg/3GbaKBSLPjic9mdWCWj3njjH+qFSf9hKhoCETXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259071 --- Comment #22 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D13d593a5b060cf7be40acfa2ca9dc9e0e= 2339a31 commit 13d593a5b060cf7be40acfa2ca9dc9e0e2339a31 Author: Alan Somers AuthorDate: 2021-11-29 02:17:34 +0000 Commit: Alan Somers CommitDate: 2022-01-01 00:38:42 +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 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33158 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 | 21 +- tests/sys/fs/fusefs/Makefile | 1 + tests/sys/fs/fusefs/last_local_modify.cc (new) | 469 +++++++++++++++++++++= ++++ 8 files changed, 516 insertions(+), 9 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=