xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3] libxc: Have xc_translate_foreign_address() set errno properly
@ 2016-03-03 13:58 Razvan Cojocaru
  2016-03-16  8:20 ` Razvan Cojocaru
  0 siblings, 1 reply; 4+ messages in thread
From: Razvan Cojocaru @ 2016-03-03 13:58 UTC (permalink / raw)
  To: xen-devel; +Cc: wei.liu2, ian.jackson, Razvan Cojocaru, stefano.stabellini

Currently it's possible for xc_translate_foreign_address() to fail
and errno still be set to success. This patch fixes the issue.
Based on the first half of Don Slutz' patch:
http://lists.xen.org/archives/html/xen-devel/2014-03/msg03720.html

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>

---
Changes since V2:
 - Fixed description text.
 - Added Wei Liu's ack.
---
 tools/libxc/xc_pagetab.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_pagetab.c b/tools/libxc/xc_pagetab.c
index ec97890..92eebd6 100644
--- a/tools/libxc/xc_pagetab.c
+++ b/tools/libxc/xc_pagetab.c
@@ -88,8 +88,10 @@ unsigned long xc_translate_foreign_address(xc_interface *xch, uint32_t dom,
             return 0;
         memcpy(&pte, map + (paddr & (PAGE_SIZE - 1)), size);
         munmap(map, PAGE_SIZE);
-        if (!(pte & 1)) 
+        if (!(pte & 1)) {
+            errno = EADDRNOTAVAIL;
             return 0;
+        }
         paddr = pte & 0x000ffffffffff000ull;
         if (level == 2 && (pte & PTE_PSE)) {
             mask = ((mask ^ ~-mask) >> 1); /* All bits below first set bit */
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH V3] libxc: Have xc_translate_foreign_address() set errno properly
  2016-03-03 13:58 [PATCH V3] libxc: Have xc_translate_foreign_address() set errno properly Razvan Cojocaru
@ 2016-03-16  8:20 ` Razvan Cojocaru
  2016-03-16  9:00   ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 4+ messages in thread
From: Razvan Cojocaru @ 2016-03-16  8:20 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, wei.liu2, stefano.stabellini

On 03/03/2016 03:58 PM, Razvan Cojocaru wrote:
> Currently it's possible for xc_translate_foreign_address() to fail
> and errno still be set to success. This patch fixes the issue.
> Based on the first half of Don Slutz' patch:
> http://lists.xen.org/archives/html/xen-devel/2014-03/msg03720.html
> 
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> ---
> Changes since V2:
>  - Fixed description text.
>  - Added Wei Liu's ack.
> ---
>  tools/libxc/xc_pagetab.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxc/xc_pagetab.c b/tools/libxc/xc_pagetab.c
> index ec97890..92eebd6 100644
> --- a/tools/libxc/xc_pagetab.c
> +++ b/tools/libxc/xc_pagetab.c
> @@ -88,8 +88,10 @@ unsigned long xc_translate_foreign_address(xc_interface *xch, uint32_t dom,
>              return 0;
>          memcpy(&pte, map + (paddr & (PAGE_SIZE - 1)), size);
>          munmap(map, PAGE_SIZE);
> -        if (!(pte & 1)) 
> +        if (!(pte & 1)) {
> +            errno = EADDRNOTAVAIL;
>              return 0;
> +        }
>          paddr = pte & 0x000ffffffffff000ull;
>          if (level == 2 && (pte & PTE_PSE)) {
>              mask = ((mask ^ ~-mask) >> 1); /* All bits below first set bit */
> 

Should I change something in this patch? It's been roughly two weeks
since the previous message with no commit to staging and no additional
comments, could I have missed a review?


Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH V3] libxc: Have xc_translate_foreign_address() set errno properly
  2016-03-16  8:20 ` Razvan Cojocaru
@ 2016-03-16  9:00   ` Konrad Rzeszutek Wilk
  2016-03-16  9:01     ` Razvan Cojocaru
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-03-16  9:00 UTC (permalink / raw)
  To: Razvan Cojocaru; +Cc: wei.liu2, stefano.stabellini, ian.jackson, xen-devel

On Wed, Mar 16, 2016 at 10:20:02AM +0200, Razvan Cojocaru wrote:
> On 03/03/2016 03:58 PM, Razvan Cojocaru wrote:
> > Currently it's possible for xc_translate_foreign_address() to fail
> > and errno still be set to success. This patch fixes the issue.
> > Based on the first half of Don Slutz' patch:
> > http://lists.xen.org/archives/html/xen-devel/2014-03/msg03720.html
> > 
> > Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> > Acked-by: Wei Liu <wei.liu2@citrix.com>
> > 
> > ---
> > Changes since V2:
> >  - Fixed description text.
> >  - Added Wei Liu's ack.
> > ---
> >  tools/libxc/xc_pagetab.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/libxc/xc_pagetab.c b/tools/libxc/xc_pagetab.c
> > index ec97890..92eebd6 100644
> > --- a/tools/libxc/xc_pagetab.c
> > +++ b/tools/libxc/xc_pagetab.c
> > @@ -88,8 +88,10 @@ unsigned long xc_translate_foreign_address(xc_interface *xch, uint32_t dom,
> >              return 0;
> >          memcpy(&pte, map + (paddr & (PAGE_SIZE - 1)), size);
> >          munmap(map, PAGE_SIZE);
> > -        if (!(pte & 1)) 
> > +        if (!(pte & 1)) {
> > +            errno = EADDRNOTAVAIL;
> >              return 0;
> > +        }
> >          paddr = pte & 0x000ffffffffff000ull;
> >          if (level == 2 && (pte & PTE_PSE)) {
> >              mask = ((mask ^ ~-mask) >> 1); /* All bits below first set bit */
> > 
> 
> Should I change something in this patch? It's been roughly two weeks
> since the previous message with no commit to staging and no additional
> comments, could I have missed a review?

Applied.

> 
> 
> Thanks,
> Razvan
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH V3] libxc: Have xc_translate_foreign_address() set errno properly
  2016-03-16  9:00   ` Konrad Rzeszutek Wilk
@ 2016-03-16  9:01     ` Razvan Cojocaru
  0 siblings, 0 replies; 4+ messages in thread
From: Razvan Cojocaru @ 2016-03-16  9:01 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: wei.liu2, stefano.stabellini, ian.jackson, xen-devel

On 03/16/2016 11:00 AM, Konrad Rzeszutek Wilk wrote:
> On Wed, Mar 16, 2016 at 10:20:02AM +0200, Razvan Cojocaru wrote:
>> On 03/03/2016 03:58 PM, Razvan Cojocaru wrote:
>>> Currently it's possible for xc_translate_foreign_address() to fail
>>> and errno still be set to success. This patch fixes the issue.
>>> Based on the first half of Don Slutz' patch:
>>> http://lists.xen.org/archives/html/xen-devel/2014-03/msg03720.html
>>>
>>> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>>> Acked-by: Wei Liu <wei.liu2@citrix.com>
>>>
>>> ---
>>> Changes since V2:
>>>  - Fixed description text.
>>>  - Added Wei Liu's ack.
>>> ---
>>>  tools/libxc/xc_pagetab.c | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/libxc/xc_pagetab.c b/tools/libxc/xc_pagetab.c
>>> index ec97890..92eebd6 100644
>>> --- a/tools/libxc/xc_pagetab.c
>>> +++ b/tools/libxc/xc_pagetab.c
>>> @@ -88,8 +88,10 @@ unsigned long xc_translate_foreign_address(xc_interface *xch, uint32_t dom,
>>>              return 0;
>>>          memcpy(&pte, map + (paddr & (PAGE_SIZE - 1)), size);
>>>          munmap(map, PAGE_SIZE);
>>> -        if (!(pte & 1)) 
>>> +        if (!(pte & 1)) {
>>> +            errno = EADDRNOTAVAIL;
>>>              return 0;
>>> +        }
>>>          paddr = pte & 0x000ffffffffff000ull;
>>>          if (level == 2 && (pte & PTE_PSE)) {
>>>              mask = ((mask ^ ~-mask) >> 1); /* All bits below first set bit */
>>>
>>
>> Should I change something in this patch? It's been roughly two weeks
>> since the previous message with no commit to staging and no additional
>> comments, could I have missed a review?
> 
> Applied.

Thank you!


Cheers,
Razvan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-03-16  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-03 13:58 [PATCH V3] libxc: Have xc_translate_foreign_address() set errno properly Razvan Cojocaru
2016-03-16  8:20 ` Razvan Cojocaru
2016-03-16  9:00   ` Konrad Rzeszutek Wilk
2016-03-16  9:01     ` Razvan Cojocaru

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).