Commit Graph

58 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
d5b67a67a2 Fix "dispvm: sanitize used memory info received from VM"
There should be no -q option - we actually want the result.

Fixes qubesos/qubes-issues#994
2015-05-13 04:12:20 +02:00
Marek Marczykowski-Górecki
77da23fba2 dispvm: fix netvm presence reporting
If desired netvm presence is different than during savefile creation(*),
defer setting the netvm until new DispVM is running - otherwise kernel
there will not notice the change and will either have (not working)
'eth0' when it shouldn't, or will not have it while it should.

Additionally set dispvm.uses_default_netvm = False, so GUI tools will
display actual netvm value.

(*) Actually compare to netvm set for dispvm template (`TEMPLATE-dvm`
VM), which can be different if user just changed that but not
regenerated dispvm savefile yet.

Fixes qubesos/qubes-issues#985
Related to qubesos/qubes-issues#862
2015-05-03 20:40:37 +02:00
Marek Marczykowski-Górecki
ed03fb4313 dispvm: remove unused imports, mark methods as static where appropriate 2015-05-03 20:25:39 +02:00
Marek Marczykowski-Górecki
3ca94941b1 dispvm: update copyright header 2015-05-03 20:25:08 +02:00
Marek Marczykowski-Górecki
4e4a4a60c3 dispvm: code style - whitespace fixes 2015-05-03 20:24:45 +02:00
Marek Marczykowski-Górecki
cd163b81be dispvm: sanitize used memory info received from VM
Luckily it is used as argument to commands with does not allow any
harmful arguments (virsh set(max)mem). Also usage in arithmetic
expression does not allow any harmful usage in this place.
2015-04-28 03:24:38 +02:00
Marek Marczykowski-Górecki
f2aa0f3e2f dispvm: prevent any output from qfile-daemon-dvm
This script is connected directly to calling process, so any output here
will disrupt qrexec service data. For example in case of qubes.OpenInVM
this will be prepended to modified file while sending it back to the
source VM - in case of no modification, it will override that file in
the source VM...
2015-04-10 19:01:46 +02:00
Marek Marczykowski-Górecki
7516737fae core: Add "dispvm_netvm" property - NetVM for DispVMs started from a VM
This allows to specify tight network isolation for a VM, and finally
close one remaining way for leaking traffic around TorVM. Now when VM is
connected to for example TorVM, its DispVMs will be also connected
there.
The new property can be set to:
 - default (uses_default_dispvm_netvm=True) - use the same NetVM/ProxyVM as the
 calling VM itself - including none it that's the case
 - None - DispVMs will be network-isolated
 - some NetVM/ProxyVM - will be used, even if calling VM is network-isolated

Closes qubesos/qubes-issues#862
2015-04-04 21:47:31 +02:00
Marek Marczykowski-Górecki
b61aef2bef dispvm: typos 2015-03-30 05:32:04 +02:00
Marek Marczykowski-Górecki
d02aa70e93 dispvm: speedup sparse files handling by using bsdtar
Apparently it is much faster. Especially during savefile preparation -
tar reads the whole file, while bsdtar gets file map and reads only used
regions.
2015-03-30 05:29:14 +02:00
Marek Marczykowski-Górecki
999698bd68 core: rename create_xenstore_entries, get rid of xid parameter
It have nothing to do with xenstore, so change the name to not mislead.
Also get rid of unused "xid" parameter - we should use XID as little as
possible, because it is not a simple task to keep it current.
2015-03-28 22:36:28 +01:00
Marek Marczykowski-Górecki
7265cb9d0f Merge branch 'dispvm-speedup' into dispvm-speedup3
Conflicts:
	dispvm/qubes-prepare-saved-domain.sh
2015-03-02 03:35:15 +01:00
Marek Marczykowski-Górecki
ef1bf9b33b dispvm: fix setting up DispVM based on non-default template
Replace 'vmdir' symlink instead of creating new one inside of 'vmdir'
directory.
2015-02-11 15:02:33 +01:00
Marek Marczykowski-Górecki
ebb9a1fcb2 dispvm: fix tray notifications (#874)
Conflicts:
	dispvm/qfile-daemon-dvm
2014-11-21 23:46:58 +01:00
Marek Marczykowski-Górecki
d5cb05fdc6 Move dispvm+qmemman service files to relevant directories
Remove them from global services dir.
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
ed13972e4e Remove xenstore-watch-qubes
Since we have Qubes DB, it needed anymore.
2014-11-19 12:50:24 +01:00
Marek Marczykowski-Górecki
0009805041 rpm+makefile: move build/install code to Makefile files
This makes build "scripts" not tied to Fedora-specific files. Especially
ease porting to other platforms.
2014-11-19 12:50:24 +01:00
Marek Marczykowski
c8fb5cfd99 dispvm: minor fixes 2014-11-19 12:50:24 +01:00
Marek Marczykowski
ff2c925e18 dispvm: use qubesdb instead of xenstore 2014-11-19 12:50:24 +01:00
Marek Marczykowski
107ebad9d5 Migration to libvirt - DispVM
Move DispVM creation to qfile-daemon-dvm/QubesDisposableVm from
qubes-restore. As actual restore is handled by libvirt, we don't get
much from separate qubes-restore process.
This code still needs some improvements, especially on performance.
2014-11-19 12:48:26 +01:00
Marek Marczykowski
a880483092 Migration to libvirt - core part
Still not all code migrated, added appropriate TODO/FIXME comments.
2014-11-19 12:47:00 +01:00
Marek Marczykowski-Górecki
7fbbcd58bf dispvm: print diagnostics to stderr 2014-11-10 11:42:47 +01:00
Marek Marczykowski-Górecki
1b99011bbb dispvm: use getopt to parse qubes-restore cmdline
It will ease further enhancements, especially adding additional options.
2014-11-04 02:55:35 +01:00
Marek Marczykowski-Górecki
c10909e9f9 dispvm: use tray notification for "Updating default DispVM savefile" msg (#877) 2014-07-04 04:33:16 +02:00
Marek Marczykowski-Górecki
6ce4028033 dispvm: use tray notify for no-memory error (#877) 2014-07-03 04:09:17 +02:00
Marek Marczykowski-Górecki
b81ecc4fba dispvm: fix tray notifications (#874) 2014-07-02 02:31:05 +02:00
Marek Marczykowski-Górecki
5443826fff Fix block hotplug script locking
Do not let hotplug script inherit lock FD - if it starts some long
running process (like xenstore-watch), it will hold the lock and block other scripts.
2014-06-27 00:08:30 +02:00
Marek Marczykowski-Górecki
1ed9c74d83 Rearrange code to not import PyQt on every qvm-* call
Move notification functions to separate file (out of guihelpers).
2014-06-05 01:59:42 +02:00
Marek Marczykowski-Górecki
2abe0649d4 dispvm: show "DisposableVM creation failed" msg using tray notification (#821) 2014-05-15 18:35:01 +02:00
Marek Marczykowski-Górecki
2bde8d906b dispvm: do not fail when notification service unavailable 2014-05-15 18:34:57 +02:00
Marek Marczykowski-Górecki
9ee207514e dispvm: increase log verbosity during domain restore 2014-04-16 16:44:42 +02:00
Marek Marczykowski-Górecki
e2f3446f22 dispvm: do not limit DispVM memory to reported allocated size
Apparently it doesn't work with some kernels - saved domain still needs
original memory amount to restore successfully. This happens at least on
3.12.14 kernel.
Because qfile-daemon-dvm always requests 400MB from qmemman, this change
should harm anyone - in any case DispVM needs 400MB free memory to
start.

Note that "xl mem-set" line is still there, which makes savefile somehow
smaller (so faster restore).
2014-04-16 16:44:42 +02:00
Marek Marczykowski-Górecki
8be54ab174 dispvm: display warning if the template is running (#754)
Opening a DispVM when the TemplateVM is running forces savefile
regeneration. Checking real root.img modification time (taking into
account root-cow.img) is tricky, so display a warning instead.
2014-03-28 04:27:51 +01:00
Vincent Penquerc'h
a8f62a960b Do not close fd 2 if it's the one we need
This should not happen based if stderr was not already closed,
but it's better not to make assumptions.
2014-02-16 11:44:03 +01:00
Marek Marczykowski-Górecki
17d2f94d8c dispvm: add -Wextra -Werror, fix warnings 2014-02-16 11:14:40 +01:00
Marek Marczykowski-Górecki
62457da085 Merge branch 'appicons' 2014-02-07 05:52:36 +01:00
Marek Marczykowski-Górecki
68ad6d0760 dispvm: start guid during savefile preparation
Now gui-agent supports reconnect to guid, so start it early to have Xorg
running in the VM.

This is still not done - for example it tries to run some commands via
(not running yet) qrexec.
2014-01-24 06:42:20 +01:00
Marek Marczykowski-Górecki
7a639911f8 dispvm: simplify DispVM preparation script 2014-01-21 04:41:18 +01:00
Marek Marczykowski-Górecki
c57c5fc107 dispvm: fix non-networked DispVM
The 'netvm-id.txt' will be empty in this case.
2014-01-16 15:48:24 +01:00
Vincent Penquerc'h
8e16c0be34 qubes-restore: check for negative numbers from file data 2014-01-06 17:47:16 +01:00
Vincent Penquerc'h
cdbfa0b7eb xenstore-watch: initialize token passed to xen
Xen will read it till the terminating NUL.

Plus return 0 on exit and define main as returning int.
2014-01-06 17:47:16 +01:00
Vincent Penquerc'h
2924a3436f qubes-restore: minor const/void fixups 2014-01-06 17:47:16 +01:00
Vincent Penquerc'h
cb39059ede qubes-restore: trivial error message \n fixups 2014-01-06 17:47:16 +01:00
Vincent Penquerc'h
702cd90c4d qubes-restore: fix buffer reading loop
It would work twice, but no more.

Also guard explicitely against buffer overflow, since once that
code actually works, sizeof(buf)-buflen will be interpreted as
large positive, and allow overwriting the stack.
2014-01-06 17:47:15 +01:00
Vincent Penquerc'h
67c198552b qubes-restore: guard against falling off the start of the buffer 2014-01-06 17:47:15 +01:00
Vincent Penquerc'h
f34728c0bb qubes-restore: make error message more truthful 2014-01-06 17:47:15 +01:00
Vincent Penquerc'h
f3850b7a71 qubes-restore: ensure we don't read outside the buffer
Marek says the 20 offset was there for a previous Xen
save file format, and is no longer needed.
2014-01-06 17:42:51 +01:00
Vincent Penquerc'h
ed24d8bc75 qubes-restore: fix race condition in allocating VM IDs 2014-01-06 17:42:51 +01:00
Vincent Penquerc'h
2cf4ad18eb qubes-restore: some syscall error checking 2014-01-06 17:42:51 +01:00
Vincent Penquerc'h
8c7a5e5933 qubes-restore: fix buffer overflow in command line building 2014-01-06 17:42:50 +01:00