diff mbox series

[v2,2/2] public/io: xs_wire: Allow Xenstore to report EPERM

Message ID 20220627123635.3416-3-julien@xen.org (mailing list archive)
State New, archived
Headers show
Series public/io: xs_wire: Allow Xenstore to report EPERM | expand

Commit Message

Julien Grall June 27, 2022, 12:36 p.m. UTC
From: Julien Grall <jgrall@amazon.com>

C Xenstored is using EPERM when the client is not allowed to change
the owner (see GET_PERMS). However, the xenstore protocol doesn't
describe EPERM so EINVAL will be sent to the client.

When writing test, it would be useful to differentiate between EINVAL
(e.g. parsing error) and EPERM (i.e. no permission). So extend
xsd_errors[] to support return EPERM.

Looking at previous time xsd_errors was extended (8b2c441a1b), it was
considered to be safe to add a new error because at least Linux driver
and libxenstore treat an unknown error code as EINVAL.

This statement doesn't cover other possible OSes, however I am not
aware of any breakage.

Signed-off-by: Julien Grall <jgrall@amazon.com>

----

Changes in v2:
    - Define EPERM at the end of xsd_errors
---
 xen/include/public/io/xs_wire.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jürgen Groß June 27, 2022, 2:52 p.m. UTC | #1
On 27.06.22 14:36, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> C Xenstored is using EPERM when the client is not allowed to change
> the owner (see GET_PERMS). However, the xenstore protocol doesn't
> describe EPERM so EINVAL will be sent to the client.
> 
> When writing test, it would be useful to differentiate between EINVAL
> (e.g. parsing error) and EPERM (i.e. no permission). So extend
> xsd_errors[] to support return EPERM.
> 
> Looking at previous time xsd_errors was extended (8b2c441a1b), it was
> considered to be safe to add a new error because at least Linux driver
> and libxenstore treat an unknown error code as EINVAL.
> 
> This statement doesn't cover other possible OSes, however I am not
> aware of any breakage.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Julien Grall June 30, 2022, 6:38 p.m. UTC | #2
Hi Juergen,

On 27/06/2022 15:52, Juergen Gross wrote:
> On 27.06.22 14:36, Julien Grall wrote:
>> From: Julien Grall <jgrall@amazon.com>
>>
>> C Xenstored is using EPERM when the client is not allowed to change
>> the owner (see GET_PERMS). However, the xenstore protocol doesn't
>> describe EPERM so EINVAL will be sent to the client.
>>
>> When writing test, it would be useful to differentiate between EINVAL
>> (e.g. parsing error) and EPERM (i.e. no permission). So extend
>> xsd_errors[] to support return EPERM.
>>
>> Looking at previous time xsd_errors was extended (8b2c441a1b), it was
>> considered to be safe to add a new error because at least Linux driver
>> and libxenstore treat an unknown error code as EINVAL.
>>
>> This statement doesn't cover other possible OSes, however I am not
>> aware of any breakage.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
> 
> Reviewed-by: Juergen Gross <jgross@suse.com>

Thanks. I have committed this patch and respin the first one.

Cheers,
diff mbox series

Patch

diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
index dd4c9c9b972d..211770911d9b 100644
--- a/xen/include/public/io/xs_wire.h
+++ b/xen/include/public/io/xs_wire.h
@@ -91,7 +91,8 @@  __attribute__((unused))
     XSD_ERROR(EBUSY),
     XSD_ERROR(EAGAIN),
     XSD_ERROR(EISCONN),
-    XSD_ERROR(E2BIG)
+    XSD_ERROR(E2BIG),
+    XSD_ERROR(EPERM),
 };
 #endif