All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Konstantin Kostiuk <kkostiuk@redhat.com>
Cc: QEMU <qemu-devel@nongnu.org>, "Dehan Meng" <demeng@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Michael Roth" <michael.roth@amd.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Yan Vugenfirer" <yvugenfi@redhat.com>
Subject: Re: Guest agent guest-exec memory usage
Date: Mon, 17 Jun 2024 14:14:22 +0100	[thread overview]
Message-ID: <ZnA2rrQ--1liaOH1@redhat.com> (raw)
In-Reply-To: <CAPMcbCpER8hvza6fO8D5Pt-8TN4fx8yP-YR0o8WSorOE44dmJw@mail.gmail.com>

On Mon, Jun 17, 2024 at 04:05:07PM +0300, Konstantin Kostiuk wrote:
> Hi All,
> 
> During the investigation of a possible memory leak in the `guest-exec`
> command of guest-agent, I found unexpected behavior for me. When we execute
> the `guest-exec` command with `capture-output = true`, guest-agent stores
> stdout/stderr until someone calls `guest-exec-status`.
> 
> Just for testing, I executed the `man man` command 1000 times with
> `capture-output = true` and guest-agent allocated 36Mb to store the results
> and it fully depends on output size.
> 
> I want to ask your opinion about this behavior. Is this behavior expected
> or not? Should we store all output forever or should we limit it by memory
> size/execution time/execution count?

If 'guest-exec' is enabled in the agent, this says that the host OS users
of the guest-agent are inherently trusted. If they're issuing many guest-exec
commands with capture-output = true, and then batching up the calls to
guest-exec-status for a later time, that's their perogative and not any
worse than other things they can already do with 'guest-exec', such as
requesting a fork-bomb.

Or to put it another way, if the guest OS admin is worried about malicious
usage of 'guest-exec' they should block this command entirely.

One of the patches I have in this series:

  https://lists.nongnu.org/archive/html/qemu-devel/2024-06/threads.html

proposes blocking guest-exec by default in the agent, as it is an
inherantly risky command to expose.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



      reply	other threads:[~2024-06-17 13:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 13:05 Guest agent guest-exec memory usage Konstantin Kostiuk
2024-06-17 13:14 ` Daniel P. Berrangé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZnA2rrQ--1liaOH1@redhat.com \
    --to=berrange@redhat.com \
    --cc=demeng@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yvugenfi@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.