Commit Graph

275 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
cd277485bb
qrexec: add clarification commends in qrexec.h
QubesOS/qubes-issues#1392
2015-11-23 16:20:34 +01:00
Rusty Bird
4f59b3df6f
qfile-unpacker: syncfs() to avoid qvm-move-to-vm data loss
Commit https://github.com/QubesOS/qubes-linux-utils/commit/c1d42f1 --
"qfile-unpacker: do not call fdatasync() at each file" fixing
QubesOS/qubes-issues#1257 -- increased the chance of data loss with
qvm-move-to-vm: Say it nominally succeeds, and *deletes* the files from
the source VM. Soon after, the destination VM or the system could crash,
or an external drive hosting ~/QubesIncoming/srcVM could get unplugged
by accident, all before the data had really been persisted to disk.

But reverting the commit (ignoring the performance issue) wouldn't
completely solve this:

  "Calling fsync() does not necessarily ensure that the entry in the
   directory containing the file has also reached disk. For that an
   explicit fsync() on a file descriptor for the directory is also
   needed."  - fsync(2)

It gets even worse for "slow symlinks" (whose target is too long to be
stored directly in the inode metadata), apparently they can't be synced
at all individually.

So instead, just call syncfs() once after everything has been unpacked:

  + Should prevent all data loss (if fs and disk are well behaved)
  + Allows caching and reordering -> no slowdown with many small files
  - Blocks until any unrelated writes on the filesystem finish :\
2015-11-18 13:11:30 +00:00
Marek Marczykowski-Górecki
8311e1263d
initramfs: fix swap size
It should be 1GB, not 1MB...

QubesOS/qubes-issues#1354
2015-11-13 14:42:51 +01:00
Marek Marczykowski-Górecki
170d46c40d
rpm: disable debuginfo subpackage in qubes-kernel-vm-support
find-debuginfo.sh in Fedora 23 doesn't properly handle packages without
any binary.

QubesOS/qubes-issues#1413
2015-11-13 06:02:37 +01:00
Marek Marczykowski-Górecki
83c03af067
Merge remote-tracking branch 'qubesos/pr/1'
* qubesos/pr/1:
  Check if QubesIncoming filesystem supports O_TMPFILE
2015-11-13 02:59:31 +01:00
Marek Marczykowski-Górecki
3826f4070f
Merge remote-tracking branch 'origin/pr/2'
* origin/pr/2:
  Fix u2mfn.ko for > 16TB RAM by not truncating to 32-bit improperly
2015-11-13 02:58:08 +01:00
Rusty Bird
74a1b4cc50
Check if QubesIncoming filesystem supports O_TMPFILE
The filesystem hosting ~/QubesIncoming/srcVM/ needs to support O_TMPFILE
too, in addition to the kernel. If it doesn't, take the use_tmpfile = 0
fallback.
2015-11-11 11:35:16 +00:00
Marek Marczykowski-Górecki
5b250eb279
version 3.1.3 2015-11-11 05:12:11 +01:00
Marek Marczykowski-Górecki
dfe5c11a55
qrexec: define NOGUI_CMD_PREFIX
This is part of the qrexec protocol, so keep it in protocol definitions.

QubesOS/qubes-issues#1392
2015-11-11 05:10:59 +01:00
Marek Marczykowski-Górecki
64331d7e09
dracut: add a safety check preventing qubes_cow_setup.sh running in dom0
Theoretically it shouldn't be a problem, because module isn't installed
in initramfs by default (in dom0), but since such error would be fatal
to dom0 (will prevent it from booting), add a safety check for it.

Probably it will be required when (if) we migrate dom0 to Debian
2015-11-11 05:10:59 +01:00
Marek Marczykowski-Górecki
3cd77e4f70
debian: introduce qubes-kernel-vm-support package
This package is responsible for kernel modules and initramfs additions
needed in Qubes VM. When installed, it is possible to switch the VM to
use PV Grub and load the kernel from inside of VM. This greatly ease
installing custom kernel modules.

Changes:
 - make qubes_cow_setup.sh working with both dracut and initramfs-tools
 - add initramfs-tools configuration/scripts (including
         qubes_cow_setup.sh)
 - modify DESTDIR to handle multiple binary packages out of single
   source

QubesOS/qubes-issues#1354
2015-11-11 05:10:59 +01:00
Marek Marczykowski-Górecki
25c05a3bd3
dracut: add dmsetup --noudevsync since we're running in pre-udev hook
When udev is installed (and scheduled to be started), but not running
yet, plain dmsetup will deadlock on waiting for udev. Since we call
`dmsetup mknodes dmroot` anyway

QubesOS/qubes-issues#1354
2015-11-09 00:44:24 +01:00
Marek Marczykowski-Górecki
aaf84ba305
kernel-modules: build/install u2mfn module by default
The module is required by gui-agent, so make sure it will be actually
installed. This would also install the module in dom0 (when
qubes-kernel-vm-support is installed there), but this this is harmless.

QubesOS/qubes-issues#1354
2015-11-08 03:51:18 +01:00
Marek Marczykowski-Górecki
789e9c2549
dracut: mount only subdirectory of /lib/modules
This makes is possible to modify /lib/modules content - especially
install other kernel packages, without unmounting the whole
/lib/modules. Since dom0-provided modules will no longer conflict with
VM kernel packages (assuming kernel versions are different), there is no
need for qubes-kernel-vm-placeholder anymore.

Having only one subdirectory of /lib/modules mounted is somehow tricky,
because:
1. Directory name isn't always the same - it depends on kernel version.
This means that mountpoint must be created dynamically (so $NEWROOT must
be mounted in R/W for a moment).
2. There is one-command way to mount only a subdirectory of some
filesystem. So use a trick: mount it in some temporary directory, get
interesting subdir with `mount --bind`, then unmount temporary
directory.

QubesOS/qubes-issues#1354
2015-11-08 03:46:25 +01:00
Marek Marczykowski-Górecki
42469fdbe4
dracut: fix qubes-vm module dependencies
It needs 'dm' for 'dmsetup' utility. Additionally fix check - qubesdb
path starts with '/'.

QubesOS/qubes-issues#1354
2015-11-08 03:44:46 +01:00
Marek Marczykowski-Górecki
882052eca0
dracut: split 'full' dracut module into 'full-dmroot' and 'full-modules'
When PV Grub will be used, VM initramfs should not contain /lib/modules
mounting code, as the VM root.img will already contains kernel modules.
Make it possible by splitting the module.

QubesOS/qubes-issues#1354
2015-11-08 03:44:27 +01:00
Marek Marczykowski-Górecki
d1238ce060
qrexec-lib: add qfile packing functions to libqubes-rpc-filecopy
This is counterpart of 5774c78 "qfile-agent: move data handling code to
libqubes-rpc-filecopy" in core-agent-linux. The main purpose is to
easily reuse the code in dom0 qvm-copy-to-vm tool.

QubesOS/qubes-issues#1324
2015-11-03 03:42:49 +01:00
Marek Marczykowski-Górecki
603e8f8685
version 3.1.2 2015-10-26 20:00:08 +01:00
qubesuser
71ce41cf61
Fix u2mfn.ko for > 16TB RAM by not truncating to 32-bit improperly
At the moment, Xen has a 16TB limit on x86, so this has no practical
impact, aside for silencing compiler truncation warnings.

Also, the rest of the GUI/u2mfn code and protocol would need to be
expanded to use 64-bit mfns for Qubes to actually work there.
2015-10-26 20:00:08 +01:00
Marek Marczykowski-Górecki
1a3be481b5
libqrexec-utils: bump SO version because of ABI change
New functions were introduced.
2015-10-26 20:00:08 +01:00
Marek Marczykowski-Górecki
6a44eaeb09
libqrexec-utils: bring back buffered write helpers
It is required to prevent deadlocks in single-threaded select-based IO
programs (namely: qrexec). POSIX API doesn't support checking how much
can be written to pipe/socket without blocking, so to prevent blocking
application must use O_NONBLOCK mode, and somehow deal with non-written
data (buffer it).

QubesOS/qubes-issues#1347
2015-10-26 20:00:08 +01:00
Marek Marczykowski-Górecki
632522b35e
libqrexec-utils: fix linker options
Fix linking with libvchan. Previously it worked because all the users
were also linked with libvchan.
2015-10-26 20:00:08 +01:00
Marek Marczykowski-Górecki
a30d583249
dracut: initialize volatile.img partitions
Do not rely on dom0 initializing that device. Actually volatile.img
content should be none of dom0 business.

QubesOS/qubes-issues#1308
2015-10-26 20:00:08 +01:00
Marek Marczykowski-Górecki
0f954034a1
dracut: abort on dmroot assemble error
Add missing "exit 1". In the other case (TemplateVM) it is already
there.
2015-10-15 02:37:20 +02:00
Marek Marczykowski-Górecki
d3d84d5d49
dracut: expand tabs to spaces
Fix to match our code style guide.
2015-10-15 02:36:23 +02:00
Marek Marczykowski-Górecki
e9c1d12aa4
version 3.1.1 2015-10-11 02:48:12 +02:00
Marek Marczykowski-Górecki
c9335ddc5c
Merge remote-tracking branch 'origin/pr/1'
* origin/pr/1:
  use 64-bit integers for memory sizes to support > 2 TB RAM
  Report Xen balloon current size instead of Linux total memory

Fixes QubesOS/qubes-issues#1136
2015-10-11 02:47:39 +02:00
Marek Marczykowski-Górecki
c1d42f1602
qfile-unpacker: do not call fdatasync() at each file (#1257)
POSIX  requires  that  a  read(2)  which  can be proved to occur after a
write() has returned returns the new data.
We want here only that other processes in the same VM will see the
file either fully written, or not see it at all. So ensuring that
linkat(2) is called after write is completed should be enough.

Fixes QubesOS/qubes-issues#1257
2015-10-11 02:47:32 +02:00
qubesuser
ec9f12815b Fix u2mfn.ko for > 16TB RAM by not truncating to 32-bit improperly
At the moment, Xen has a 16TB limit on x86, so this has no practical
impact, aside for silencing compiler truncation warnings.

Also, the rest of the GUI/u2mfn code and protocol would need to be
expanded to use 64-bit mfns for Qubes to actually work there.
2015-10-10 11:59:36 +02:00
qubesuser
2f5ef8e2aa use 64-bit integers for memory sizes to support > 2 TB RAM 2015-10-10 01:37:30 +02:00
qubesuser
2d871075cc Report Xen balloon current size instead of Linux total memory
This results in qmemman knowing about the memory map overhead and
properly sizing VMs.
2015-10-10 00:47:10 +02:00
Marek Marczykowski-Górecki
e745b87939
version 3.1.0 2015-09-30 22:13:51 +02:00
Marek Marczykowski-Górecki
b853318baf impconverter: add icon data getters
Raw icon data is needed to set it on X11 windows.

QubesOS/qubes-issues#967
2015-09-20 04:47:38 +02:00
Marek Marczykowski-Górecki
8d5157a8ab
version 3.0.10 2015-08-08 04:23:00 +02:00
Marek Marczykowski-Górecki
fc3347c914
imgconverter: ensure that connection to the VM is properly closed
Even in case of some error (for example invalid image).
2015-08-08 04:22:05 +02:00
Marek Marczykowski-Górecki
f5b65101ad
Merge remote-tracking branch 'origin/pr/1'
* origin/pr/1:
  archlinux: ensure /usr/sbin is not use to follow archlinux packaging guidelines
  archlinux: update to match new dependancies and archlinux /usr/lib guidelines
2015-08-02 19:55:54 +02:00
Olivier MEDOC
9ee8281ab7 archlinux: ensure /usr/sbin is not use to follow archlinux packaging guidelines 2015-07-08 14:33:48 +02:00
Olivier MEDOC
80b4c2ecd5 archlinux: update to match new dependancies and archlinux /usr/lib guidelines 2015-07-08 11:08:47 +02:00
Marek Marczykowski-Górecki
a1af4eb719 version 3.0.9 2015-07-08 05:58:15 +02:00
Marek Marczykowski-Górecki
6e69ce2234 imgconverter: use more meaningful error for empty icon image 2015-07-07 23:12:56 +02:00
Marek Marczykowski-Górecki
7ce11969b1 version 3.0.8 2015-07-01 07:11:28 +02:00
Marek Marczykowski-Górecki
643ff5876d udev: do not use a separate lock for udev block scripts
Since migration to QubesDB, it isn't needed anymore (QubesDB have no
problem with concurrent writes, as transactions are not supported).
This should speedup system startup.
2015-06-28 21:59:39 +02:00
Marek Marczykowski-Górecki
ceb0e25d3b fedora: fix systemd service files permission 2015-06-16 02:59:49 +02:00
Marek Marczykowski-Górecki
5d49d78a7c version 3.0.7 2015-04-28 13:23:09 +02:00
Marek Marczykowski-Górecki
4e7b4e17c3 imgconverter: add eq operation for Image class
This is used to check if the new icon is in any way different from the
old one and possibly avoid regenerating all of them.
2015-04-28 13:22:48 +02:00
Marek Marczykowski-Górecki
e9eedf2c6a version 3.0.6 2015-04-15 18:49:02 +02:00
Marek Marczykowski-Górecki
21ca16fbdd imgconverter: do not start gui daemon
It is not needed and will cause problems in case of firstboot.
2015-04-15 14:25:31 +02:00
Marek Marczykowski-Górecki
b9d914ce5c version 3.0.5 2015-04-03 11:26:47 +02:00
Marek Marczykowski-Górecki
68bbd408d7 udev: fix block devices ignoring rule
First of all there was missing ']'. Bu additionally change that rule to
detect partitioned loop devices instead of device-mapper.
2015-04-03 11:14:15 +02:00
Marek Marczykowski-Górecki
0eeb7b8bf0 version 3.0.4 2015-04-01 00:11:15 +02:00