* [Qemu-devel] [PATCH] nvdimm: allow read/write zero-size namespace label
@ 2017-01-13 3:02 Li Qiang
2017-01-13 9:00 ` Xiao Guangrong
0 siblings, 1 reply; 4+ messages in thread
From: Li Qiang @ 2017-01-13 3:02 UTC (permalink / raw)
To: guangrong.xiao, qemu-devel; +Cc: Li Qiang
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.
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
hw/mem/nvdimm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index db896b0..4042097 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -114,7 +114,7 @@ static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp)
static void nvdimm_validate_rw_label_data(NVDIMMDevice *nvdimm, uint64_t size,
uint64_t offset)
{
- assert((nvdimm->label_size >= size + offset) && (offset + size > offset));
+ assert((nvdimm->label_size >= size + offset) && (offset + size >= offset));
}
static void nvdimm_read_label_data(NVDIMMDevice *nvdimm, void *buf,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] nvdimm: allow read/write zero-size namespace label
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
0 siblings, 1 reply; 4+ messages in thread
From: Xiao Guangrong @ 2017-01-13 9:00 UTC (permalink / raw)
To: Li Qiang, qemu-devel; +Cc: Li Qiang
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] nvdimm: allow read/write zero-size namespace label
2017-01-13 9:00 ` Xiao Guangrong
@ 2017-01-14 11:22 ` Li Qiang
2017-01-16 13:34 ` Stefan Hajnoczi
0 siblings, 1 reply; 4+ messages in thread
From: Li Qiang @ 2017-01-14 11:22 UTC (permalink / raw)
To: Xiao Guangrong; +Cc: qemu-devel, Li Qiang
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.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] nvdimm: allow read/write zero-size namespace label
2017-01-14 11:22 ` Li Qiang
@ 2017-01-16 13:34 ` Stefan Hajnoczi
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2017-01-16 13:34 UTC (permalink / raw)
To: Li Qiang; +Cc: Xiao Guangrong, Li Qiang, qemu-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-16 13:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.