From nobody Tue Jan 18 01:03:19 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 6691F194EDBE for ; Tue, 18 Jan 2022 01:03:19 +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 4Jd9WB6Yfcz3r4c for ; Tue, 18 Jan 2022 01:03:18 +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 C02F41819B for ; Tue, 18 Jan 2022 01:03:18 +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 20I13IMf016638 for ; Tue, 18 Jan 2022 01:03:18 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20I13IQS016637 for bugs@FreeBSD.org; Tue, 18 Jan 2022 01:03:18 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:03:19 +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=1642467799; 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=ugFQ3L79AIlq5SQ6jTbaU9nav1esPE7MWoH3SufGRuc=; b=qfg/9MV7rwI4z+UsRFdqr7fonuriNh0ZP14n+7IsX0wasaWRT2hO2ISuK436jUMY2oXDlH 3fOFe/c8s0Klkpv5UQ+DWPh25kEsAWa9Wt8yLSKDhoODxeCs3CIavY25qVlUHfu0s5TNON 5+tkh9+JksTZdXbTNm8zP58NemMpmuD7NxhwQ3zVpUPRtuJPE+lz/V8NbO+j/Mf2xhSQRQ Y/z3zow2nZGNr5WepsBf8hQpZGNJaaOKB5Fg3cEWoYIvUioxcWNBEJsuEtHi+cPHa46Yjy Ru1DO7hljZ9CWgdHmp923W1ZhbZf+Mh+OgBssAoKbbLQ66xHryM1GBRMD9R7og== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642467799; a=rsa-sha256; cv=none; b=BgZOV7XHsEQuzSfvUbmbrPpMf5ocKqDE10q7QVAo7QUx7W4EdqFDq8HLuySZPCh3e0i1MJ y+QlMl6kbNsBKEVbBECn8YeXOzndWH3SELy3vc4FN9SW0P33gYK+YM493tR+2VbuhQ4BO5 XObGWSYAeh54IecXTJDiZcMnPdzT73zZ348AcbHH5VvGvejyfFjb2T6qsnB/f86PvWrb9a l7Ck0O4L8nOsUnIdWjUWckL7aXLacQPf+PKlzAFnBFZYOjOnPdvWCrY33E2Jf9cm3NjESC CoZRHT5i+ENcpim7byx1WGZFwHJg2XLDJRTTe4uIvjY08zJaUCBJUYXZKWXsfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259071 --- Comment #23 from commit-hook@FreeBSD.org --- A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D36ba360558a752dfa3832ec19bb182e5c= f1876d7 commit 36ba360558a752dfa3832ec19bb182e5cf1876d7 Author: Alan Somers AuthorDate: 2021-11-29 02:17:34 +0000 Commit: Alan Somers CommitDate: 2022-01-18 00:59:03 +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 | 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.=