From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Julio Montes <julio.montes@intel.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com,
Xiao Guangrong <xiaoguangrong.eric@gmail.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [RFC] memory-backend-file/nvdimm: support read-only files as memory-backends
Date: Tue, 9 Jul 2019 12:53:45 +0200 [thread overview]
Message-ID: <1eb3f75e-01b0-990b-44c2-1770982da5b5@redhat.com> (raw)
In-Reply-To: <20190708211936.8037-1-julio.montes@intel.com>
Cc'ing Igor & Xiao.
On 7/8/19 11:19 PM, Julio Montes wrote:
> Currently is not possible to use a file that is part of a read-only
> filesystem as memory backend for nvdimm devices, even if this is not modified
> in the guest. In order to improve the security of Virtual Machines that share
> and do not modify the memory-backend-file, QEMU should support
> read-only memory-backeds.
>
> Use case:
> * Kata Containers use a memory-backed-file as read-only rootfs, and this
> file is used to start all the virtual machines in the node.
> It would be really bad if somehow a malicious container modified it.
>
> Signed-off-by: Julio Montes <julio.montes@intel.com>
> ---
> exec.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index 50ea9c5aaa..1eb170b55a 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1852,6 +1852,12 @@ static int file_ram_open(const char *path,
> break;
> }
> g_free(filename);
> + } else if (errno == EROFS) {
> + fd = open(path, O_RDONLY);
While I can understand your use case, I'm not sure we want this silenced
as default. I'd expect an explicit command line option for that backend,
but I don't know well this area so let's wait for other to review.
> + if (fd >= 0) {
> + /* @path names an existing read-only file, use it */
> + break;
> + }
> }
> if (errno != EEXIST && errno != EINTR) {
> error_setg_errno(errp, errno,
> --
> 2.17.2
>
next prev parent reply other threads:[~2019-07-09 10:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 21:19 [Qemu-devel] [RFC] memory-backend-file/nvdimm: support read-only files as memory-backends Julio Montes
2019-07-09 10:53 ` Philippe Mathieu-Daudé [this message]
2019-07-15 9:08 ` Stefan Hajnoczi
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=1eb3f75e-01b0-990b-44c2-1770982da5b5@redhat.com \
--to=philmd@redhat.com \
--cc=imammedo@redhat.com \
--cc=julio.montes@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xiaoguangrong.eric@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).