Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
msdosfs rename report by kib
Browse files Browse the repository at this point in the history
  • Loading branch information
kostikbel committed Sep 29, 2021
1 parent 077ac45 commit 85d8f3a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions 2021q3/msdosfs_rename.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
== Fixes for msdosfs_rename VOP

Contact: Konstantin Belousov <kib@FreeBSD.org>
Contact: Peter Holm <pho@FreeBSD.org>

Our msdosfs(5) implementation is old code, and it has a relatively
large legacy cost. In particular, even though it got fine-grained
locking and miscellaneous bugfixes over time, sometimes a serious issue
is found in it.

Recently trasz@ found that msdosfs rename can be easily deadlocked.
Further examination of rename code revealed a lot of issues with locking,
potential use after free, and filesystem structure corruption.

As part of the update, locking in the msdosfs rename code was reworked.
We need to lock up to four vnodes, and check one path to ensure that
rename does not create circular parent relations between directories.
For that, the locking procedure was copied from UFS rename, where all
vnodes except the first are locked in try-mode. Lockless relockup was
added to msdosfs and the directory path checker was changed to non-blocking
mode.

During this work, all known issues were fixed and msdosfs passes
enhanced stress2 suite of tests.

Sponsor: The FreeBSD Foundation (kib's contributions)

0 comments on commit 85d8f3a

Please sign in to comment.