* [PATCH] libxl: preserve errno in libxl__xcinfo2xlinfo()
@ 2025-08-27 5:57 Jan Beulich
2025-08-28 1:16 ` Jason Andryuk
0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2025-08-27 5:57 UTC (permalink / raw)
To: xen-devel@lists.xenproject.org; +Cc: Anthony PERARD, Juergen Gross
Callers observing errors elsewhere may be confused by the ENOSYS that
the Flask operation would yield on a Flask-disabled hypervisor.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Of course I don't know whether clobbering errno is perhaps deemed "fine"
in libxl.
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -277,6 +277,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx
libxl_dominfo *xlinfo)
{
size_t size;
+ int saved_errno = errno;
memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t));
xlinfo->domid = xcinfo->domain;
@@ -284,6 +285,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx
if (libxl_flask_sid_to_context(ctx, xlinfo->ssidref,
&xlinfo->ssid_label, &size) < 0)
xlinfo->ssid_label = NULL;
+ errno = saved_errno;
xlinfo->dying = !!(xcinfo->flags&XEN_DOMINF_dying);
xlinfo->shutdown = !!(xcinfo->flags&XEN_DOMINF_shutdown);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libxl: preserve errno in libxl__xcinfo2xlinfo()
2025-08-27 5:57 [PATCH] libxl: preserve errno in libxl__xcinfo2xlinfo() Jan Beulich
@ 2025-08-28 1:16 ` Jason Andryuk
2025-08-28 6:11 ` Jan Beulich
2025-09-08 12:40 ` Anthony PERARD
0 siblings, 2 replies; 4+ messages in thread
From: Jason Andryuk @ 2025-08-28 1:16 UTC (permalink / raw)
To: Jan Beulich, xen-devel@lists.xenproject.org; +Cc: Anthony PERARD, Juergen Gross
On 2025-08-27 01:57, Jan Beulich wrote:
> Callers observing errors elsewhere may be confused by the ENOSYS that
> the Flask operation would yield on a Flask-disabled hypervisor.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> Of course I don't know whether clobbering errno is perhaps deemed "fine"
> in libxl.
I wonder if it would be better to special case
libxl_flask_sid_to_context() to preserve errno on ENOSYS. flask
returning ENOSYS is common, but libxl_flask_sid_to_context() can
legitimately have error.
I guess this is fine if we want to use this approach:
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
> --- a/tools/libs/light/libxl_domain.c
> +++ b/tools/libs/light/libxl_domain.c
> @@ -277,6 +277,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx
> libxl_dominfo *xlinfo)
> {
> size_t size;
> + int saved_errno = errno;
>
> memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t));
> xlinfo->domid = xcinfo->domain;
> @@ -284,6 +285,7 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx
> if (libxl_flask_sid_to_context(ctx, xlinfo->ssidref,
> &xlinfo->ssid_label, &size) < 0)
> xlinfo->ssid_label = NULL;
> + errno = saved_errno;
>
> xlinfo->dying = !!(xcinfo->flags&XEN_DOMINF_dying);
> xlinfo->shutdown = !!(xcinfo->flags&XEN_DOMINF_shutdown);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libxl: preserve errno in libxl__xcinfo2xlinfo()
2025-08-28 1:16 ` Jason Andryuk
@ 2025-08-28 6:11 ` Jan Beulich
2025-09-08 12:40 ` Anthony PERARD
1 sibling, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2025-08-28 6:11 UTC (permalink / raw)
To: Jason Andryuk
Cc: Anthony PERARD, Juergen Gross, xen-devel@lists.xenproject.org
On 28.08.2025 03:16, Jason Andryuk wrote:
> On 2025-08-27 01:57, Jan Beulich wrote:
>> Callers observing errors elsewhere may be confused by the ENOSYS that
>> the Flask operation would yield on a Flask-disabled hypervisor.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> Of course I don't know whether clobbering errno is perhaps deemed "fine"
>> in libxl.
>
> I wonder if it would be better to special case
> libxl_flask_sid_to_context() to preserve errno on ENOSYS. flask
> returning ENOSYS is common, but libxl_flask_sid_to_context() can
> legitimately have error.
But then libxl__xcinfo2xlinfo() also shouldn't (effectively) ignore such
other errors? Question is what it should do in such an event.
> I guess this is fine if we want to use this approach:
>
> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Thanks.
Jan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libxl: preserve errno in libxl__xcinfo2xlinfo()
2025-08-28 1:16 ` Jason Andryuk
2025-08-28 6:11 ` Jan Beulich
@ 2025-09-08 12:40 ` Anthony PERARD
1 sibling, 0 replies; 4+ messages in thread
From: Anthony PERARD @ 2025-09-08 12:40 UTC (permalink / raw)
To: Jason Andryuk
Cc: Jan Beulich, xen-devel@lists.xenproject.org, Anthony PERARD,
Juergen Gross
On Wed, Aug 27, 2025 at 09:16:38PM -0400, Jason Andryuk wrote:
> On 2025-08-27 01:57, Jan Beulich wrote:
> > Callers observing errors elsewhere may be confused by the ENOSYS that
> > the Flask operation would yield on a Flask-disabled hypervisor.
> >
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > ---
> > Of course I don't know whether clobbering errno is perhaps deemed "fine"
> > in libxl.
>
> I wonder if it would be better to special case libxl_flask_sid_to_context()
> to preserve errno on ENOSYS. flask returning ENOSYS is common, but
> libxl_flask_sid_to_context() can legitimately have error.
Well, errno=ENOSYS gives information about why
libxl_flask_sid_to_context() returns an error.
They are multiple error code for returns libxl_*() functions but they
aren't really check. We often rely on errno to print an error message.
And in this case, libxl_flask_sid_to_context() doesn't event return a
proper libxl_error value.
> I guess this is fine if we want to use this approach:
>
> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
Thanks,
--
Anthony PERARD
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-08 12:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 5:57 [PATCH] libxl: preserve errno in libxl__xcinfo2xlinfo() Jan Beulich
2025-08-28 1:16 ` Jason Andryuk
2025-08-28 6:11 ` Jan Beulich
2025-09-08 12:40 ` Anthony PERARD
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.