public/io: xs_wire: Allow Xenstore to report EPERM
PATCH 1/1 public/io: xs_wire: Allow Xenstore to report EPERM
From: Julien Grall <[email protected]>
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.
--- xen/include/public/io/xs_wire.h | 1 + 1 file changed, 1 insertion(+)
xen/include/public/io/xs_wire.h +1 -0
@@ -76,6 +76,7 @@ static struct xsd_errors xsd_errors[] __attribute__((unused)) #endif = { + XSD_ERROR(EPERM), XSD_ERROR(EINVAL), XSD_ERROR(EACCES), XSD_ERROR(EEXIST),
Signature · 1 line
2.32.0
xen/include/public/io/xs_wire.h static struct xsd_errors xsd_errors[] · line 82
Quoted 10 lines · Julien Grall
xen/include/public/io/xs_wire.h +1
-0@@ -76,6 +76,7 @@ static struct xsd_errors xsd_errors[] __attribute__((unused)) #endif = { + XSD_ERROR(EPERM), XSD_ERROR(EINVAL), XSD_ERROR(EACCES), XSD_ERROR(EEXIST),
Inserting ahead of EINVAL looks to break xenstored_core.c:send_error(), which - legitimately or not - assumes EINVAL to be first.
Jan
Hi Jan,
Quoted 13 lines · Jan Beulich
xen/include/public/io/xs_wire.h static struct xsd_errors xsd_errors[] · line 82
Quoted 10 lines · Julien Grall
xen/include/public/io/xs_wire.h +1
-0@@ -76,6 +76,7 @@ static struct xsd_errors xsd_errors[] __attribute__((unused)) #endif = { + XSD_ERROR(EPERM), XSD_ERROR(EINVAL), XSD_ERROR(EACCES), XSD_ERROR(EEXIST),Inserting ahead of EINVAL looks to break xenstored_core.c:send_error(),
:(.
Quoted 1 line
which - legitimately or not - assumes EINVAL to be first.
I am not sure who else is relying on this. So I would consider this to be bake in the ABI. I think the minimum is to add a BUILD_BUG_ON() in send_error().
I will also move EPERM towards the end (I added first because EPERM is 1).
Cheers,
Signature · 1 line
Julien Grall
Quoted 17 lines · Julien Grall
Hi Jan,
Quoted 13 lines · Jan Beulich
xen/include/public/io/xs_wire.h static struct xsd_errors xsd_errors[] · line 82
Quoted 10 lines · Julien Grall
xen/include/public/io/xs_wire.h +1
-0@@ -76,6 +76,7 @@ static struct xsd_errors xsd_errors[] __attribute__((unused)) #endif = { + XSD_ERROR(EPERM), XSD_ERROR(EINVAL), XSD_ERROR(EACCES), XSD_ERROR(EEXIST),Inserting ahead of EINVAL looks to break xenstored_core.c:send_error(),
Quoted 7 lines
:(.
Quoted 1 line
which - legitimately or not - assumes EINVAL to be first.
I am not sure who else is relying on this. So I would consider this to be bake in the ABI. I think the minimum is to add a
BUILD_BUG_ON()insend_error().I will also move EPERM towards the end (I added first because EPERM is 1).
I agree to both plans.
Juergen