Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect muvm-server, spawn one as root and monitor available host memory #89

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

slp
Copy link
Collaborator

@slp slp commented Oct 15, 2024

The goal of this PR is to enable muvm to request the guest to adjust its file system cache goals accordingly to the amount of available memory on the host.

The first two commits just set the infrastructure, first by adding some minimal protection to muvm-server, and then spawning a second instance of it as root (we need this to operate in "/proc/sys/vm", but surely will come handy for many other things).

The latter implements the monitor and the ability to request the guest to adjust watermark_scale_factor as needed, or even to drop its pagecache if the situation is critical.

While our threat model targets single user systems, let's at least
protect muvm-server with an authentication cookie, so only the user
creating the microVM (and root) can access it.

The cookie is stored in the lockfile, instead of the server port (this
was useless in practice and generated confusion as could override the
command line). The lockfile is located in XDG_RUNTIME_DIR, which in
properly configured systems is only accessible to its owner.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Being able to run commands as root comes handy to debug the guest and
will also be used to tune the virtual memory parameters on demand.

Signed-off-by: Sergio Lopez <slp@redhat.com>
This monitor checks the ratio of memory available on the host and, if
needed, contacts the VM (through muvm-server) to adjust
/proc/sys/vm/watermark_scale_factor and, if the situation is critical,
to request it to drop its caches.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant