Skip to content

Commit

Permalink
Tighten xenstore access for meminfo-writer
Browse files Browse the repository at this point in the history
Set the permission only to the 'memory/meminfo' key (needs to be created
first), not the whole 'memory' dir. And do it only if memory balancing
is enabled.
This avoids VM potentially messing with other keys (like static-max), or
reporting meminfo when not expected to.
  • Loading branch information
marmarek committed Dec 27, 2022
1 parent f8835ea commit 8ce26eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2270,10 +2270,12 @@ def create_qdb_entries(self):

# TODO: Currently the whole qmemman is quite Xen-specific, so stay with
# xenstore for it until decided otherwise
if qmemman_present:
if qmemman_present and self.maxmem:
xs_basedir = f"/local/domain/{self.xid}"
self.app.vmm.xs.write('',
f"{xs_basedir}/memory/meminfo", "")
self.app.vmm.xs.set_permissions('',
'/local/domain/{}/memory'.format(
self.xid),
f"{xs_basedir}/memory/meminfo",
[{'dom': self.xid}])

self.fire_event('domain-qdb-create')
Expand Down

0 comments on commit 8ce26eb

Please sign in to comment.