* [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106
@ 2016-09-21 12:41 Razvan Cojocaru
2016-09-21 12:49 ` George Dunlap
2016-09-21 12:52 ` Jan Beulich
0 siblings, 2 replies; 5+ messages in thread
From: Razvan Cojocaru @ 2016-09-21 12:41 UTC (permalink / raw)
To: xen-devel; +Cc: george.dunlap, andrew.cooper3, Razvan Cojocaru, jbeulich
Added missing error checks in p2m_set_mem_access_multi().
Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
Changes since V1:
- Returning -EFAULT instead of -EINVAL.
- Replaced stray TAB with spaces.
---
xen/arch/x86/mm/p2m.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index b16e563..9526fff 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1936,8 +1936,12 @@ long p2m_set_mem_access_multi(struct domain *d,
uint8_t access;
uint64_t gfn_l;
- copy_from_guest_offset(&gfn_l, pfn_list, start, 1);
- copy_from_guest_offset(&access, access_list, start, 1);
+ if ( copy_from_guest_offset(&gfn_l, pfn_list, start, 1) ||
+ copy_from_guest_offset(&access, access_list, start, 1) )
+ {
+ rc = -EFAULT;
+ break;
+ }
if ( !xenmem_access_to_p2m_access(p2m, access, &a) )
{
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106
2016-09-21 12:41 [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106 Razvan Cojocaru
@ 2016-09-21 12:49 ` George Dunlap
2016-09-21 12:52 ` Jan Beulich
1 sibling, 0 replies; 5+ messages in thread
From: George Dunlap @ 2016-09-21 12:49 UTC (permalink / raw)
To: Razvan Cojocaru, xen-devel; +Cc: george.dunlap, andrew.cooper3, jbeulich
On 21/09/16 13:41, Razvan Cojocaru wrote:
> Added missing error checks in p2m_set_mem_access_multi().
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> ---
> Changes since V1:
> - Returning -EFAULT instead of -EINVAL.
> - Replaced stray TAB with spaces.
> ---
> xen/arch/x86/mm/p2m.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index b16e563..9526fff 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1936,8 +1936,12 @@ long p2m_set_mem_access_multi(struct domain *d,
> uint8_t access;
> uint64_t gfn_l;
>
> - copy_from_guest_offset(&gfn_l, pfn_list, start, 1);
> - copy_from_guest_offset(&access, access_list, start, 1);
> + if ( copy_from_guest_offset(&gfn_l, pfn_list, start, 1) ||
> + copy_from_guest_offset(&access, access_list, start, 1) )
> + {
> + rc = -EFAULT;
> + break;
> + }
This will return EFAULT even if it has managed to successfully handle
some of the pfn/access pairs. It looks like this is sort of typical
(the handful of places I could find that had copy_from_guest* inside a
loop followed a similar form).
So:
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
I'll check this in.
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106
2016-09-21 12:41 [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106 Razvan Cojocaru
2016-09-21 12:49 ` George Dunlap
@ 2016-09-21 12:52 ` Jan Beulich
2016-09-21 12:55 ` George Dunlap
1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2016-09-21 12:52 UTC (permalink / raw)
To: Razvan Cojocaru; +Cc: george.dunlap, andrew.cooper3, xen-devel
>>> On 21.09.16 at 14:41, <rcojocaru@bitdefender.com> wrote:
> Added missing error checks in p2m_set_mem_access_multi().
I think the patch subject should say what is being changed/fixed,
and the two Coverity IDs should be listed here instead. Otherwise
someone looking over just the patch titles will have no idea what
this is actually about. If I end up committing this, I'll take the liberty
to do adjustments.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106
2016-09-21 12:52 ` Jan Beulich
@ 2016-09-21 12:55 ` George Dunlap
2016-09-21 13:45 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: George Dunlap @ 2016-09-21 12:55 UTC (permalink / raw)
To: Jan Beulich, Razvan Cojocaru; +Cc: george.dunlap, andrew.cooper3, xen-devel
On 21/09/16 13:52, Jan Beulich wrote:
>>>> On 21.09.16 at 14:41, <rcojocaru@bitdefender.com> wrote:
>> Added missing error checks in p2m_set_mem_access_multi().
>
> I think the patch subject should say what is being changed/fixed,
> and the two Coverity IDs should be listed here instead. Otherwise
> someone looking over just the patch titles will have no idea what
> this is actually about. If I end up committing this, I'll take the liberty
> to do adjustments.
I said I'd commit it, so how about:
x86/mm: Add missing copy_from_user error checks in p2m_set_access_multi
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106
2016-09-21 12:55 ` George Dunlap
@ 2016-09-21 13:45 ` Jan Beulich
0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2016-09-21 13:45 UTC (permalink / raw)
To: Razvan Cojocaru, George Dunlap; +Cc: george.dunlap, andrew.cooper3, xen-devel
>>> On 21.09.16 at 14:55, <george.dunlap@citrix.com> wrote:
> On 21/09/16 13:52, Jan Beulich wrote:
>>>>> On 21.09.16 at 14:41, <rcojocaru@bitdefender.com> wrote:
>>> Added missing error checks in p2m_set_mem_access_multi().
>>
>> I think the patch subject should say what is being changed/fixed,
>> and the two Coverity IDs should be listed here instead. Otherwise
>> someone looking over just the patch titles will have no idea what
>> this is actually about. If I end up committing this, I'll take the liberty
>> to do adjustments.
>
> I said I'd commit it, so how about:
>
> x86/mm: Add missing copy_from_user error checks in p2m_set_access_multi
Sound good.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-09-21 13:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 12:41 [PATCH V2] x86/mm: Fix Coverity issues 1373105 and 1373106 Razvan Cojocaru
2016-09-21 12:49 ` George Dunlap
2016-09-21 12:52 ` Jan Beulich
2016-09-21 12:55 ` George Dunlap
2016-09-21 13:45 ` Jan Beulich
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.