Opened 15 years ago
#5335 new defect
When running a VM, Hard Disks should be opened ShareMode=0 to prevent other processes writing to them
| Reported by: | Mark Cranness | Owned by: | |
|---|---|---|---|
| Component: | other | Version: | VirtualBox 3.0.8 |
| Keywords: | Cc: | ||
| Guest type: | other | Host type: | other |
Description
While a VM is running, the Hard Disk file (VDI) is opened in a mode that allows shared read-write by other processes. The hard disk files should be opened in locked/exclusive write/no write sharing mode to ensure safe access.
e.g. In Windows, while a VM is running, the following test C code succesfully opens the VDI for writing (but should be blocked):
CreateFile(TEXT("Play.vdi")
,GENERIC_READ | GENERIC_WRITE
,FILE_SHARE_READ | FILE_SHARE_WRITE
,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
Existing behaviour of allowing other processes write access allows another VM on a remote PC to boot a VDI on a network share, resulting in two VMs having concurrent access to the VDI which causes a BSOD. Instead an error message prevent starting of the second remote VM. See Windows XP Guest BSOD

