core-admin/core
Marek Marczykowski-Górecki 247cff335f core: fix race condition in qubes.xml locking (#906)
QubesVmCollection.save() overrides qubes.xml by creating new file, then
renaming it over the old one. If any process has that (old) file open
at the same time - especially while waiting on lock_db_for_writing() -
it will end up in accessing old, already unlinked file.

The exact calls would look like:
P1                                      P2
lock_db_for_writing
  fd = open('qubes.xml')
  fcntl(fd, F_SETLK, ...)

                                      lock_db_for_writing
                                          fd = open('qubes.xml')
                                          fcntl(fd, F_SETLK, ...)
...
save():
    open(temp-file)
    write(temp-file, ...)
    ...
    flush(temp-file)
    rename(temp-file, 'qubes.xml')
    close(fd) // close old file

                                      lock_db_for_writing succeed
                                      *** fd points at already unlinked
                                          file
unlock_db
    close(qubes.xml)

To fix that problem, added a check if (already locked) file is still the
same as qubes.xml.
2014-10-22 03:53:30 +02:00
..
tests
__init__.py
.gitignore Move all files one level up 2013-03-16 19:56:51 +01:00
backup.py backups: use default kernel if saved one is not installed 2014-10-01 03:50:50 +02:00
guihelpers.py
modules
notify.py notify: missing import 2014-07-20 13:39:02 +02:00
qubes.py core: fix race condition in qubes.xml locking (#906) 2014-10-22 03:53:30 +02:00
qubesutils.py support partitions on loop devices 2014-09-19 11:00:56 +02:00