From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Baptiste Le Duc" <baptiste.le-duc@vates.tech>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Julien Grall" <julien@xen.org>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1 2/3] xen/domain: fix UBSAN null pointer dereference in vcpu_info_reset()
Date: Tue, 19 May 2026 12:55:08 +0200 [thread overview]
Message-ID: <bedfec37-4c74-40dc-904e-b80e33461be7@gmail.com> (raw)
In-Reply-To: <2be07ba3-879b-4c79-8103-b4951ab4cf53@suse.com>
On 5/19/26 11:37 AM, Jan Beulich wrote:
> On 19.05.2026 10:39, Oleksii Kurochko wrote:
>> vcpu_info_reset() maps v->vcpu_info_area.map to the per-vcpu slot inside
>> the domain's shared_info page for vcpus with id < XEN_LEGACY_MAX_VCPUS,
>> and falls back to dummy_vcpu_info for vcpus beyond that limit.
>>
>> However, it does not guard against d->shared_info being NULL. The
>> shared_info() macro expands to a member access through d->shared_info,
>> so when an architecture does not allocate a shared_info page the
>> dereference triggers UBSAN:
>> UBSAN: Undefined behaviour in common/domain.c:325:10
>> member access within null pointer of type 'struct shared_info_t'
>>
>> Extend the existing fallback condition to also cover the case where no
>> shared_info page has been allocated, mapping the vcpu to dummy_vcpu_info
>> instead. This is the correct behaviour: dummy_vcpu_info already serves
>> as the safe stand-in for vcpus that have no usable shared_info slot.
>>
>> Fixes: 295514ff75506 ("common: convert vCPU info area registration")
>
> I question this, largely (but not only) because I also ...
>
>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>> Reviewed-by: Baptiste Le Duc <baptiste.le-duc@vates.tech>
>> ---
>> RISC-V does not allocate a shared_info page at the momemnt because its
>> guests run in dom0less mode and do not use the Xen PV ABI, so
>> d->shared_info remains NULL throughout domain lifetime.
>
> ... question this mode of operation. Yes, you may (for now) be able to get
> away without, but e.g. event channels will want supporting at some point.
> Which will require a shared info page. Better put that in place right away,
> even if the guests you test with don't use it (yet). Certain other common
> code also assumes d->shared_info to never be NULL for an alive domain.
>
Would it be fine than to allocate it in arch_domain_create() ... :
if ( (d->shared_info = alloc_xenheap_pages(0, 0)) == NULL )
goto fail;
clear_page(d->shared_info);
... but without calling share_xen_page_with_guest() after that
allocation as share_xen_page_with_guest() isn't implemented at the moment?
Thanks.
~ Oleksii
next prev parent reply other threads:[~2026-05-19 10:55 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 8:39 [PATCH v1 0/3] UBSAN fixes Oleksii Kurochko
2026-05-19 8:39 ` [PATCH v1 1/3] xen/riscv: fix switch_stack_and_jump() Oleksii Kurochko
2026-05-19 9:28 ` Jan Beulich
2026-05-19 10:50 ` Oleksii Kurochko
2026-05-19 11:48 ` Jan Beulich
2026-05-19 11:50 ` Andrew Cooper
2026-05-19 8:39 ` [PATCH v1 2/3] xen/domain: fix UBSAN null pointer dereference in vcpu_info_reset() Oleksii Kurochko
2026-05-19 9:37 ` Jan Beulich
2026-05-19 10:55 ` Oleksii Kurochko [this message]
2026-05-19 11:22 ` Oleksii Kurochko
2026-05-19 11:32 ` Andrew Cooper
2026-05-19 11:48 ` Oleksii Kurochko
2026-05-19 11:51 ` Jan Beulich
2026-05-19 11:56 ` Andrew Cooper
2026-05-19 12:06 ` Jan Beulich
2026-05-19 13:50 ` Andrew Cooper
2026-05-19 13:52 ` Oleksii Kurochko
2026-05-19 11:53 ` Jan Beulich
2026-05-20 11:33 ` Oleksii Kurochko
2026-05-20 12:03 ` Jan Beulich
2026-05-20 13:40 ` Oleksii Kurochko
2026-05-20 14:21 ` Jan Beulich
2026-05-20 15:08 ` Oleksii Kurochko
2026-05-20 15:21 ` Oleksii Kurochko
2026-05-19 8:39 ` [PATCH v1 3/3] xen/libfdt: fix UBSAN null pointer in fdt_property() Oleksii Kurochko
2026-05-19 8:49 ` Orzel, Michal
2026-05-19 9:16 ` Oleksii Kurochko
2026-05-19 9:37 ` Orzel, Michal
2026-05-20 7:51 ` Oleksii Kurochko
2026-05-20 7:56 ` Orzel, Michal
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=bedfec37-4c74-40dc-904e-b80e33461be7@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=baptiste.le-duc@vates.tech \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--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.