Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disk_*: handle out of range accesses #415

Merged
merged 3 commits into from
Dec 2, 2024
Merged

Conversation

jstarks
Copy link
Member

@jstarks jstarks commented Nov 30, 2024

Currently, the SCSI and NVMe emulators validate that a read/write/unmap is in range before calling down to the backing disks. This creates a TOCTOU problem because the disk size can change at any time, asynchronously from any IO. It also creates additional synchronization headaches since the disk implementations must be able to provide the up-to-date disk size efficiently.

As a first step, add this range checking in the various disk implementations. A subsequent change can remove the redundant checks in the NVMe and SCSI emulators.

Currently, the SCSI and NVMe emulators validate that a read/write/unmap
is in range before calling down to the backing disks. This creates a
TOCTOU problem because the disk size can change at any time,
asynchronously from any IO. It also creates additional synchronization
headaches since the disk implementations must be able to provide the
up-to-date disk size efficiently.

As a first step, add this range checking in the various disk
implementations. A subsequent change can remove the redundant checks in
the NVMe and SCSI emulators.
@jstarks jstarks requested review from a team as code owners November 30, 2024 05:34
@jstarks jstarks merged commit dd781a0 into microsoft:main Dec 2, 2024
25 checks passed
@jstarks jstarks deleted the disk_range_1 branch December 2, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants