From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Teddy Astie <teddy.astie@vates.tech>,
Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Julian Vetter <julian.vetter@vates.tech>,
Andrii Sultanov <andriy.sultanov@vates.tech>,
Guillaume Thouvenin <guillaume.thouvenin@vates.tech>,
Oleksii Kurochko <oleksii.kurochko@gmail.com>
Subject: Re: [PATCH 1/2] tools/ocaml: Fix crash in Xenctrl.domain_getinfo{,list} on ARM
Date: Wed, 29 Jul 2026 12:57:40 +0100 [thread overview]
Message-ID: <58778d19-4000-4cde-bbb3-e59855bccd2a@citrix.com> (raw)
In-Reply-To: <1785325606.8631fc262581453bbf619ec5b2062170.19fadb2d454000e099@vates.tech>
On 29/07/2026 12:46 pm, Teddy Astie wrote:
> Le 28/07/2026 à 17:49, Andrew Cooper a écrit :
>> The Store_field(result, 16, arch_config) sits inside an ifdef x86,
>> meaning
>> that on other archtiectures the pointer is not filled in. The Ocaml
>> runtime
>> then falls over a NULL pointer (really the Val_unit used to initialise
>> 'result') when the layout in the heap doesn't match the type system.
>>
>> Rearrange alloc_domaininfo() to avoid this. Similarly to
>> physinfo_arch_caps(), raise an exception if the architecture code hasn't
>> filled in an appropriate tag. Move the setup of arch_domainconfig to be
>> common logic.
>>
>> In order to simplify the addition of other architectures, remove the
>> arch_config variable (resuing tmp as it's touched exactly once), and
>> rename
>> x86_arch_config to be arch_config so each architecture can fill in a
>> suitable
>> one without needing more local variables.
>>
>> Reported-by: Julian Vetter <julian.vetter@vates.tech>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
Thanks.
> I guess that requires the OCaml user side to be appropriately patched
> to not get data in the wrong order ?
I don't quite understand the question. There are no changes needed to
the OCaml side. The problem is that this piece of C is not producing an
object that the type system describes.
Prior to this patch, Xenctrl.domain_getinfo on ARM produces a malformed
object with a missing (NULL-ish) interior pointer. Attempts to
interpret this object in Ocaml code segfault.
With this patch, Xenctrl.domain_getinfo on ARM will unconditionally
raise Failure. Ocaml code won't segfault, but the overall behaviour
isn't helpful.
With patch 2, Xenctrl.domain_getinfo on ARM gets you back a good object.
~Andrew
next prev parent reply other threads:[~2026-07-29 11:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 15:48 [PATCH for-4.22 0/2] tools/ocaml: Fixes to Xenctrl.domain_getinfo{,list}() Andrew Cooper
2026-07-28 15:48 ` [PATCH 1/2] tools/ocaml: Fix crash in Xenctrl.domain_getinfo{,list} on ARM Andrew Cooper
2026-07-29 6:03 ` Jan Beulich
2026-07-29 8:51 ` Andrew Cooper
2026-07-29 11:46 ` Teddy Astie
2026-07-29 11:57 ` Andrew Cooper [this message]
2026-07-28 15:48 ` [PATCH 2/2] tools/ocaml: Fill arch_config for ARM in domain_getinfo{,list}() Andrew Cooper
2026-07-28 15:52 ` Jan Beulich
2026-07-28 15:53 ` Andrew Cooper
2026-07-29 11:49 ` Teddy Astie
2026-07-28 15:50 ` [PATCH for-4.22 0/2] tools/ocaml: Fixes to Xenctrl.domain_getinfo{,list}() Oleksii Kurochko
2026-07-28 19:36 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58778d19-4000-4cde-bbb3-e59855bccd2a@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=andriy.sultanov@vates.tech \
--cc=guillaume.thouvenin@vates.tech \
--cc=julian.vetter@vates.tech \
--cc=oleksii.kurochko@gmail.com \
--cc=teddy.astie@vates.tech \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.