* [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed()
@ 2022-06-22 1:28 Zhenzhong Duan
2022-06-22 21:02 ` Peter Xu
2022-07-22 6:49 ` David Hildenbrand
0 siblings, 2 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2022-06-22 1:28 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, peterx, david, f4bug
The comment of flatview_access_allowed() suggests to pass address
within that memory region, this isn't ture in some call sites.
This makes qemu log in flatview_access_allowed() confusing and
potential risk if the input parameter will be checked in the future.
Fixes: 3ab6fdc91b72 ("softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_ACCESS_ERROR")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
softmmu/physmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index fb16be57a6c6..214cb04c8fc3 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2850,7 +2850,7 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
l = len;
mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
- if (!flatview_access_allowed(mr, attrs, addr, len)) {
+ if (!flatview_access_allowed(mr, attrs, addr1, l)) {
return MEMTX_ACCESS_ERROR;
}
return flatview_write_continue(fv, addr, attrs, buf, len,
@@ -2917,7 +2917,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
l = len;
mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
- if (!flatview_access_allowed(mr, attrs, addr, len)) {
+ if (!flatview_access_allowed(mr, attrs, addr1, l)) {
return MEMTX_ACCESS_ERROR;
}
return flatview_read_continue(fv, addr, attrs, buf, len,
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed()
2022-06-22 1:28 [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed() Zhenzhong Duan
@ 2022-06-22 21:02 ` Peter Xu
2022-07-22 3:31 ` Duan, Zhenzhong
2022-07-22 6:49 ` David Hildenbrand
1 sibling, 1 reply; 5+ messages in thread
From: Peter Xu @ 2022-06-22 21:02 UTC (permalink / raw)
To: Zhenzhong Duan; +Cc: qemu-devel, pbonzini, david, f4bug
On Wed, Jun 22, 2022 at 09:28:39AM +0800, Zhenzhong Duan wrote:
> The comment of flatview_access_allowed() suggests to pass address
> within that memory region, this isn't ture in some call sites.
>
> This makes qemu log in flatview_access_allowed() confusing and
> potential risk if the input parameter will be checked in the future.
>
> Fixes: 3ab6fdc91b72 ("softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_ACCESS_ERROR")
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Thanks,
--
Peter Xu
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed()
2022-06-22 21:02 ` Peter Xu
@ 2022-07-22 3:31 ` Duan, Zhenzhong
0 siblings, 0 replies; 5+ messages in thread
From: Duan, Zhenzhong @ 2022-07-22 3:31 UTC (permalink / raw)
To: Peter Xu
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, david@redhat.com,
f4bug@amsat.org
>-----Original Message-----
>From: Peter Xu <peterx@redhat.com>
>Sent: Thursday, June 23, 2022 5:03 AM
>To: Duan, Zhenzhong <zhenzhong.duan@intel.com>
>Cc: qemu-devel@nongnu.org; pbonzini@redhat.com; david@redhat.com;
>f4bug@amsat.org
>Subject: Re: [PATCH] softmmu/physmem: Fix input parameters for
>flatview_access_allowed()
>
>On Wed, Jun 22, 2022 at 09:28:39AM +0800, Zhenzhong Duan wrote:
>> The comment of flatview_access_allowed() suggests to pass address
>> within that memory region, this isn't ture in some call sites.
>>
>> This makes qemu log in flatview_access_allowed() confusing and
>> potential risk if the input parameter will be checked in the future.
>>
>> Fixes: 3ab6fdc91b72 ("softmmu/physmem: Introduce MemTxAttrs::memory
>> field and MEMTX_ACCESS_ERROR")
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>
>Reviewed-by: Peter Xu <peterx@redhat.com>
Hi,
No progress for a long time, any further comments? Thanks!
Zhenzhong
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed()
2022-06-22 1:28 [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed() Zhenzhong Duan
2022-06-22 21:02 ` Peter Xu
@ 2022-07-22 6:49 ` David Hildenbrand
2022-07-22 7:52 ` Duan, Zhenzhong
1 sibling, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2022-07-22 6:49 UTC (permalink / raw)
To: Zhenzhong Duan, qemu-devel; +Cc: pbonzini, peterx, f4bug
On 22.06.22 03:28, Zhenzhong Duan wrote:
> The comment of flatview_access_allowed() suggests to pass address
> within that memory region, this isn't ture in some call sites.
s/ture/true/
>
> This makes qemu log in flatview_access_allowed() confusing and
> potential risk if the input parameter will be checked in the future.
>
> Fixes: 3ab6fdc91b72 ("softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_ACCESS_ERROR")
My opinion is to not use fixes tags unless there is really something
broken -- a user-visible effect of a BUG exists.
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
> softmmu/physmem.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index fb16be57a6c6..214cb04c8fc3 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -2850,7 +2850,7 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
>
> l = len;
> mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
> - if (!flatview_access_allowed(mr, attrs, addr, len)) {
> + if (!flatview_access_allowed(mr, attrs, addr1, l)) {
> return MEMTX_ACCESS_ERROR;
> }
> return flatview_write_continue(fv, addr, attrs, buf, len,
> @@ -2917,7 +2917,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
>
> l = len;
> mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
> - if (!flatview_access_allowed(mr, attrs, addr, len)) {
> + if (!flatview_access_allowed(mr, attrs, addr1, l)) {
> return MEMTX_ACCESS_ERROR;
> }
> return flatview_read_continue(fv, addr, attrs, buf, len,
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed()
2022-07-22 6:49 ` David Hildenbrand
@ 2022-07-22 7:52 ` Duan, Zhenzhong
0 siblings, 0 replies; 5+ messages in thread
From: Duan, Zhenzhong @ 2022-07-22 7:52 UTC (permalink / raw)
To: David Hildenbrand, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, peterx@redhat.com, f4bug@amsat.org
>-----Original Message-----
>From: David Hildenbrand <david@redhat.com>
>Sent: Friday, July 22, 2022 2:49 PM
>To: Duan, Zhenzhong <zhenzhong.duan@intel.com>; qemu-
>devel@nongnu.org
>Cc: pbonzini@redhat.com; peterx@redhat.com; f4bug@amsat.org
>Subject: Re: [PATCH] softmmu/physmem: Fix input parameters for
>flatview_access_allowed()
>
>On 22.06.22 03:28, Zhenzhong Duan wrote:
>> The comment of flatview_access_allowed() suggests to pass address
>> within that memory region, this isn't ture in some call sites.
>
>s/ture/true/
Will fix.
>
>>
>> This makes qemu log in flatview_access_allowed() confusing and
>> potential risk if the input parameter will be checked in the future.
>>
>> Fixes: 3ab6fdc91b72 ("softmmu/physmem: Introduce MemTxAttrs::memory
>> field and MEMTX_ACCESS_ERROR")
>
>My opinion is to not use fixes tags unless there is really something broken --
>a user-visible effect of a BUG exists.
Thanks David, I will remove it in v2.
Zhenzhong
>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> ---
>> softmmu/physmem.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/softmmu/physmem.c b/softmmu/physmem.c index
>> fb16be57a6c6..214cb04c8fc3 100644
>> --- a/softmmu/physmem.c
>> +++ b/softmmu/physmem.c
>> @@ -2850,7 +2850,7 @@ static MemTxResult flatview_write(FlatView *fv,
>> hwaddr addr, MemTxAttrs attrs,
>>
>> l = len;
>> mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
>> - if (!flatview_access_allowed(mr, attrs, addr, len)) {
>> + if (!flatview_access_allowed(mr, attrs, addr1, l)) {
>> return MEMTX_ACCESS_ERROR;
>> }
>> return flatview_write_continue(fv, addr, attrs, buf, len, @@
>> -2917,7 +2917,7 @@ static MemTxResult flatview_read(FlatView *fv,
>> hwaddr addr,
>>
>> l = len;
>> mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
>> - if (!flatview_access_allowed(mr, attrs, addr, len)) {
>> + if (!flatview_access_allowed(mr, attrs, addr1, l)) {
>> return MEMTX_ACCESS_ERROR;
>> }
>> return flatview_read_continue(fv, addr, attrs, buf, len,
>
>Reviewed-by: David Hildenbrand <david@redhat.com>
>
>--
>Thanks,
>
>David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-22 7:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22 1:28 [PATCH] softmmu/physmem: Fix input parameters for flatview_access_allowed() Zhenzhong Duan
2022-06-22 21:02 ` Peter Xu
2022-07-22 3:31 ` Duan, Zhenzhong
2022-07-22 6:49 ` David Hildenbrand
2022-07-22 7:52 ` Duan, Zhenzhong
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).