Page MenuHomeFreeBSD

fuse copy_file_range() fixes
ClosedPublic

Authored by kib on Nov 15 2023, 11:06 PM.
Tags
None
Referenced Files
F102637365: D42625.id130176.diff
Fri, Nov 15, 4:08 AM
F102630325: D42625.diff
Fri, Nov 15, 1:45 AM
Unknown Object (File)
Sun, Nov 10, 9:48 PM
Unknown Object (File)
Oct 15 2024, 2:44 PM
Unknown Object (File)
Oct 13 2024, 12:55 PM
Unknown Object (File)
Oct 12 2024, 3:21 PM
Unknown Object (File)
Oct 11 2024, 6:44 AM
Unknown Object (File)
Oct 10 2024, 7:51 AM
Subscribers

Details

Summary
fuse_vnop_copy_file_range(): add safety

v_mount for unlocked vnode could be NULL, check for it.  Explain why it
is safe to access fs-specific data for mp if it is read as non-NULL.
fuse_vnop_copy_file_range(): use vn_lock_pair()

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Nov 15 2023, 11:06 PM

LGTM. But under what circumstances can mp be NULL? We should probably add a regression test for that.

This revision is now accepted and ready to land.Nov 15 2023, 11:21 PM

LGTM. But under what circumstances can mp be NULL? We should probably add a regression test for that.

The vnodes passed to VOP_COPY_FILE_RANGE() are not locked, so they can be reclaimed any moment. Then v_data and v_mount become NULL.

vn_lock_pair() locks doomed vnodes; check for freed vnodes after the lock.

This revision now requires review to proceed.Nov 15 2023, 11:53 PM
sys/fs/fuse/fuse_vnops.c
884

Would VN_IS_DOOMED() be better here (since it would make the intention of the check clearer)?

sys/fs/fuse/fuse_vnops.c
884

Then doomed but not yet reclaimed vnode cannot be handled. In principle there it is not very important, but other VOPs are more critical WRT this (subtle) difference. It is important for instance for fsync() or inactivate().

This is just my preference to be more permissive in such situations, after I realized this problem during some UFS work.

This revision is now accepted and ready to land.Nov 16 2023, 12:42 AM