|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/3] xen/domain: fix UBSAN null pointer dereference of d->shared_info
On 6/2/26 6:11 PM, Oleksii Kurochko wrote: - Update the commit message. - Protect some other places in common code from NULL pointer deref of d->shared_info.What I'm still missing is the description clarifying why other uses don't need guarding (or that there simply are no other uses, which - however - I doubt).I will add an explicit paragraph mentioning that the 2L ops in event_2l.c are unreachable for a domain with no shared_info.The only place which isn't covered now is domctl.c:108 (virt_to_mfn(d- >shared_info)) is only reached via the XEN_DOMCTL_getdomaininfo path and as RISC-V doesn't use it now it could be left as it is what also could be added to commit message. For that part could be considered ... --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -320,7 +320,7 @@ void vcpu_info_reset(struct vcpu *v) struct domain *d = v->domain; v->vcpu_info_area.map = - ((v->vcpu_id < XEN_LEGACY_MAX_VCPUS) + ((v->vcpu_id < XEN_LEGACY_MAX_VCPUS && d->shared_info) ? (vcpu_info_t *)&shared_info(d, vcpu_info[v->vcpu_id]) : &dummy_vcpu_info); }At the example of this: The extra conditionals are dead code on x86 and Arm. While the status of the respective Misra rule is still uncertain for Xen, imo we'd be better off avoiding the introduction of new dead code. Which in turn means we may need some kind of abstraction to have these extra conditionals in place only for arch-es not supporting shared-info at all.
...
+#ifdef CONFIG_HAS_SHARED_INFO
info->shared_info_frame =
gfn_x(mfn_to_gfn(d, _mfn(virt_to_mfn(d->shared_info))));
BUG_ON(SHARED_M2P(info->shared_info_frame));
+#else
+ info->shared_info_frame = INVALID_GFN_RAW;
+#endif
~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |