From owner-freebsd-bugs@freebsd.org Tue Dec 4 17:50:47 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8602C131458B for ; Tue, 4 Dec 2018 17:50:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 1D1408599A for ; Tue, 4 Dec 2018 17:50:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id D42541314582; Tue, 4 Dec 2018 17:50:46 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97EF81314581 for ; Tue, 4 Dec 2018 17:50:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36E0B85995 for ; Tue, 4 Dec 2018 17:50:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 6BA6032F4 for ; Tue, 4 Dec 2018 17:50:45 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4Hojrw072458 for ; Tue, 4 Dec 2018 17:50:45 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id wB4Hoj9V072457 for bugs@FreeBSD.org; Tue, 4 Dec 2018 17:50:45 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 233783] [fusefs] returns cached truncated data Date: Tue, 04 Dec 2018 17:50:45 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new 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 Many People X-Bugzilla-Who: asomers@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-Rspamd-Queue-Id: 1D1408599A X-Spamd-Result: default: False [-0.35 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.18)[-0.179,0]; NEURAL_SPAM_LONG(0.03)[0.034,0]; ASN(0.00)[asn:10310, ipnet:2001:1900:2254::/48, country:US]; NEURAL_HAM_SHORT(-0.20)[-0.202,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:50:47 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D233783 Bug ID: 233783 Summary: [fusefs] returns cached truncated data Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: asomers@FreeBSD.org fuse(4) caches data in the kernel, even when mounted with "-o direct_io".=20 After a truncation, it may return cached data from past the truncation poin= t.=20 This data is invalid and should've been dropped during the truncation. I've reproduced this behavior with libfuse's "passthrough" example program using both CURRENT @r340987 and 12.0-BETA4. Steps to reproduce: $ cd /path/to/freebsd/sources/tools/regression/fsx $ make $ sudo pkg install pkgconf fusefs-libs3 $ git clone git@github.com:libfuse/libfuse.git $ cd libfuse/example $ cc -Wall -I/usr/local/include/fuse3 -L/usr/local/lib -lfuse3 -lpthread passthrough.c -o passthrough $ sudo kldload fuse $ mkdir /tmp/mnt $ sudo ./passthrough -f -sd -o allow_other /tmp/mnt Then, run fsx in a separate session: $ cd /tmp/mnt/tmp $ /usr/obj/whatever/amd64.amd64/tools/regression/fsx/fsx -WR -P /tmp -S10 fsx.bin fsx will terminate with this output. It's reproducible since we specified = the seed: mapped writes DISABLED Seed set to 10 skipping zero size read skipping zero size read skipping zero size read skipping zero size read skipping zero size read skipping zero size read skipping zero size read truncating to largest ever: 0x10016 READ BAD DATA: offset =3D 0xe1e6, size =3D 0xe229 OFFSET GOOD BAD RANGE 0x1b8df 0x0000 0xb708 0x b2b operation# (mod 256) for the bad data may be 8 LOG DUMP (11 total operations): 1(1 mod 256): SKIPPED (no operation) 2(2 mod 256): SKIPPED (no operation) 3(3 mod 256): SKIPPED (no operation) 4(4 mod 256): SKIPPED (no operation) 5(5 mod 256): SKIPPED (no operation) 6(6 mod 256): SKIPPED (no operation) 7(7 mod 256): SKIPPED (no operation) 8(8 mod 256): WRITE 0x1b8df thru 0x21ac6 (0x61e8 bytes) HOLE ***= WWWW 9(9 mod 256): TRUNCATE DOWN from 0x21ac7 to 0x10016 ******WWWW 10(10 mod 256): WRITE 0x3e90a thru 0x3ffff (0x16f6 bytes) HOLE ***= WWWW 11(11 mod 256): READ 0xe1e6 thru 0x1c40e (0xe229 bytes) ***RRRR*** Correct content saved for comparison (maybe hexdump "fsx.bin" vs "fsx.bin.fsxgood") By comparing FSX's output to passthrough's, we can deduce where fuse.ko serviced a read from its cache: fsx's log passthrough's log --------- ----------------- write 0x1b8df 0x61e8 write 112863 18209 write 131072 6855 trunc 137927 trunc 0x10016 trunc 65558 write 0x3d90a 0x16f6 read 196608 65536 write 256266 5878 trunc 262144 read 0xe1e6 0x1c40e read 0 65536 (services 57830 - 655= 36) (services 65536 - 173= 556) The miscompare happened at address 0x1b8df, which was in the part of the re= ad serviced from the cache, and it's the first part of that cached read that e= ver contained non-zero data in the lifetime of this test. --=20 You are receiving this mail because: You are the assignee for the bug.=