All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: add an extra check when validating a huge pv L2 entry
@ 2009-09-09 15:19 Jan Beulich
  2009-09-09 15:35 ` Keir Fraser
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2009-09-09 15:19 UTC (permalink / raw)
  To: xen-devel

While get_page_and_type_from_pagenr() (through get_page_from_pagenr())
does the needed mfn_valid() check, get_data_page() doesn't and, it
being passed a struct page_info pointer, really expects it's caller(s)
to do.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- 2009-08-18.orig/xen/arch/x86/mm.c	2009-09-09 13:32:06.000000000 +0200
+++ 2009-08-18/xen/arch/x86/mm.c	2009-09-09 13:35:02.000000000 +0200
@@ -868,7 +868,10 @@ get_page_from_l2e(
         int writeable = !!(l2e_get_flags(l2e) & _PAGE_RW);
   
         do {
-            rc = get_data_page(mfn_to_page(m), d, writeable);
+            if ( mfn_valid(m) )
+                rc = get_data_page(mfn_to_page(m), d, writeable);
+            else
+                rc = -EINVAL;
             if ( unlikely(!rc) )
             {
                 while ( m-- > mfn )

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: add an extra check when validating a huge pv L2 entry
  2009-09-09 15:19 [PATCH] x86: add an extra check when validating a huge pv L2 entry Jan Beulich
@ 2009-09-09 15:35 ` Keir Fraser
  2009-09-09 15:51   ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2009-09-09 15:35 UTC (permalink / raw)
  To: Jan Beulich, xen-devel@lists.xensource.com

On 09/09/2009 16:19, "Jan Beulich" <JBeulich@novell.com> wrote:

> -            rc = get_data_page(mfn_to_page(m), d, writeable);
> +            if ( mfn_valid(m) )
> +                rc = get_data_page(mfn_to_page(m), d, writeable);
> +            else
> +                rc = -EINVAL;

'else rc = 0' would be more like it, eh?

 -- Keir

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: add an extra check when validating a huge pv L2 entry
  2009-09-09 15:35 ` Keir Fraser
@ 2009-09-09 15:51   ` Jan Beulich
  2009-09-09 16:15     ` Michael J Coss
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2009-09-09 15:51 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel@lists.xensource.com

>>> Keir Fraser <keir.fraser@eu.citrix.com> 09.09.09 17:35 >>>
>On 09/09/2009 16:19, "Jan Beulich" <JBeulich@novell.com> wrote:
>
>> -            rc = get_data_page(mfn_to_page(m), d, writeable);
>> +            if ( mfn_valid(m) )
>> +                rc = get_data_page(mfn_to_page(m), d, writeable);
>> +            else
>> +                rc = -EINVAL;
>
>'else rc = 0' would be more like it, eh?

Oh, yes - I got confused (again) by the inconsistencies in what return
values mean for the various functions.

Jan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: add an extra check when validating a huge pv L2 entry
  2009-09-09 15:51   ` Jan Beulich
@ 2009-09-09 16:15     ` Michael J Coss
  2009-09-09 17:35       ` Keir Fraser
  0 siblings, 1 reply; 5+ messages in thread
From: Michael J Coss @ 2009-09-09 16:15 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

Jan Beulich wrote:
>>>> Keir Fraser <keir.fraser@eu.citrix.com> 09.09.09 17:35 >>>
>>>>         
>> On 09/09/2009 16:19, "Jan Beulich" <JBeulich@novell.com> wrote:
>>
>>     
>>> -            rc = get_data_page(mfn_to_page(m), d, writeable);
>>> +            if ( mfn_valid(m) )
>>> +                rc = get_data_page(mfn_to_page(m), d, writeable);
>>> +            else
>>> +                rc = -EINVAL;
>>>       
>> 'else rc = 0' would be more like it, eh?
>>     
>
> Oh, yes - I got confused (again) by the inconsistencies in what return
> values mean for the various functions.
>
> Jan
>   
I don't think that that's correct.  The else clause is for the 
mfn_valid(m) failure case, and it seems appropriate to set the rc to 
some non-zero value.

---Michael J Coss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: add an extra check when validating a huge pv L2 entry
  2009-09-09 16:15     ` Michael J Coss
@ 2009-09-09 17:35       ` Keir Fraser
  0 siblings, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2009-09-09 17:35 UTC (permalink / raw)
  To: Michael J Coss, xen-devel@lists.xensource.com

On 09/09/2009 17:15, "Michael J Coss" <mjcoss@alcatel-lucent.com> wrote:

>> Oh, yes - I got confused (again) by the inconsistencies in what return
>> values mean for the various functions.
>> 
>> Jan
>>   
> I don't think that that's correct.  The else clause is for the
> mfn_valid(m) failure case, and it seems appropriate to set the rc to
> some non-zero value.

You're confused - look at the surrounding context of the patch. Anyway, I
ultimately checked in soemthing even clearer, as c/s 20189.

 K.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-09 17:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-09 15:19 [PATCH] x86: add an extra check when validating a huge pv L2 entry Jan Beulich
2009-09-09 15:35 ` Keir Fraser
2009-09-09 15:51   ` Jan Beulich
2009-09-09 16:15     ` Michael J Coss
2009-09-09 17:35       ` Keir Fraser

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.