qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Li Qiang <liq3ea@gmail.com>
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>,
	Li Qiang <liqiang6-s@360.cn>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] nvdimm: allow read/write zero-size namespace label
Date: Mon, 16 Jan 2017 13:34:01 +0000	[thread overview]
Message-ID: <20170116133401.GE14681@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAKXe6SJXWzu2pTZz_vRGic4ZomPcVGVOfOvig43=8ZoZet0cRQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1593 bytes --]

On Sat, Jan 14, 2017 at 07:22:28PM +0800, Li Qiang wrote:
> Hello Guangrong,
> 
> 
> 2017-01-13 17:00 GMT+08:00 Xiao Guangrong <guangrong.xiao@linux.intel.com>:
> 
> >
> >
> > On 01/13/2017 11:02 AM, Li Qiang wrote:
> >
> >> From: Li Qiang <liqiang6-s@360.cn>
> >>
> >> The spec doesn't say the namespace label can't be zero
> >> when read/write it. As this is no harmful, just allow
> >> it.
> >>
> >>
> > WHY?
> >
> > The spec said that the label should be at least 128K.
> >
> 
> Yes, the label size has a limit, but in NVDIMM_DSM_Interface_Example.pdf
> section 4.5.1
> When the guest get namespace label data, the 'Length' is not limited, if it
> is 0, it will trigger
> this assert.
> 
> static void nvdimm_validate_rw_label_data(NVDIMMDevice *nvdimm, uint64_t
> size,
>                                         uint64_t offset)
> {
>     assert((nvdimm->label_size >= size + offset) && (offset + size >
> offset));
> }
> 
> Though I don't know what the exact behavior of this action in real
> hardware. I just think it should not
> trigger assert and exit when the guest get 0-size label data.
> 
> Anyway, this is just a suggestion, If my understand is wrong, just ignore
> this.

QEMU must prevent guests from triggering assertions.  If the assertion
causes a core dump then host resources are consumed and this could be a
denial-of-service.  An assertion failure in nested virtualization can
kill sibling VMs and is therefore also a denial-of-service.

The size=0 case must be handled in some way (either an error or a nop).

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

      reply	other threads:[~2017-01-16 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13  3:02 [Qemu-devel] [PATCH] nvdimm: allow read/write zero-size namespace label Li Qiang
2017-01-13  9:00 ` Xiao Guangrong
2017-01-14 11:22   ` Li Qiang
2017-01-16 13:34     ` Stefan Hajnoczi [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=20170116133401.GE14681@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=liq3ea@gmail.com \
    --cc=liqiang6-s@360.cn \
    --cc=qemu-devel@nongnu.org \
    /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).