opnsense-src/tests/sys
Alan Somers 36ba360558 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 from
   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 <chogata@moosefs.pro>
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D33158

(cherry picked from commit 13d593a5b0)
2022-01-17 17:59:03 -07:00
..
acl Drop "All rights reserved" from all my stuff. This includes 2020-10-28 13:46:11 +00:00
aio aio: revert the workaround for bug 251828 in the tests 2021-10-07 15:38:25 -06:00
audit swapon(8): adapt to the new swapoff(2) interface 2021-12-20 02:29:11 +02:00
auditpipe Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
capsicum Simplify the capsicum-test wrapper script 2021-03-17 22:22:49 +00:00
cddl tests/sys/cddl: correctly quote atf_set "require.progs" 2021-03-17 22:22:50 +00:00
common pf tests: test ALTQ CBQ on top of if_vlan 2021-09-01 15:27:01 +02:00
devrandom Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
fifo Avoid hard-coding pipe buffer sizes in the pipe and fifo kqueue tests. 2020-05-20 17:48:18 +00:00
file vfs: Permit unix sockets to be opened with O_PATH 2021-10-17 17:15:44 -04:00
fs Fix a race in fusefs that can corrupt a file's size. 2022-01-17 17:59:03 -07:00
geom gmultipath failloop test: Add a checker for dtrace executes successfully or not 2021-09-30 11:57:06 +08:00
kern tests: Add some regression tests for a couple of KERN_PROC_* sysctls 2022-01-16 10:40:39 -05:00
kqueue kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME 2021-10-06 02:03:53 -05:00
mac Resolve conflict between the fusefs(5) and mac_bsdextended(4) tests 2020-05-02 20:14:59 +00:00
mqueue Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
net net tests: fix if_stf:6to4 2021-12-11 10:39:15 +01:00
netgraph tests/netgraph: Tests for ng_vlan_rotate 2021-06-16 13:25:04 +02:00
netinet tests/libalias: Portrange 2022-01-03 12:18:10 +01:00
netinet6 Add arp/ndp tests in addition to rtsock ll tests. 2021-08-24 09:02:15 +02:00
netipsec ping: fix some man pages and tests after r368045 2020-11-26 04:55:02 +00:00
netmap Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
netpfil pf tests: more thorough pfsync defer test 2021-12-13 14:49:27 +01:00
opencrypto crypto: Test all of the AES-CCM KAT vectors. 2021-10-21 14:19:24 -07:00
pjdfstest Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
posixshm posixshm tests: Fix occasional largepage_mprotect failures 2022-01-10 09:05:12 -05:00
sys sys/bitset.h: reduce visibility of BIT_* macros 2022-01-14 18:17:30 +02:00
vfs tests/sys/vfs/lookup_cap_dotdot: No longer aborts after ATF update 2021-03-17 12:22:03 +00:00
vm shared shadow vm object invalidation regression test 2021-07-02 14:14:32 -07:00
vmm vmm: Add credential to cdev object 2021-09-01 09:07:42 -04:00
Makefile vmm: Add credential to cdev object 2021-09-01 09:07:42 -04:00
Makefile.depend DIRDEPS_BUILD: Connect MK_TESTS. 2016-03-09 22:46:01 +00:00
Makefile.inc Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00