|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [BUG] Potential double-free in Xen dt-overlay attach/remove error path
Hello Team, I was advised to report this issue in this way because dt-overlay is currently experimental and not security supported. I would like to report a potential memory safety issue in Xen related to the Device Tree overlay handling logic. Problem DescriptionA double-free / use-after-free condition may occur in the dt-overlay handling path when an overlay attachment fails and the same overlay is later removed. The issue arises because rangeset objects are freed on the failure path of handle_attach_overlay_nodes(), but the corresponding pointers are not cleared. Subsequently, handle_remove_overlay_nodes() may operate on these stale pointers, leading to a second free. Affected Component
Relevant functions:
ImpactThis issue may lead to:
Given that this occurs in the hypervisor context, the impact could extend beyond a simple crash under certain conditions. Root CauseThe issue originates from inconsistent memory management between the attach failure path and the remove path. In handle_attach_overlay_nodes(), the failure path frees rangeset objects: However, the corresponding pointers (entry->irq_ranges and entry->iomem_ranges) are not set to NULL afterward, leaving dangling pointers in the entry structure. Later, in handle_remove_overlay_nodes(), the same fields are used again: Since the pointers were not invalidated after being freed, this leads to:
This creates a double-free / use-after-free condition. Environment
Suggested FixAfter calling rangeset_destroy(), the corresponding pointers should be set to NULL to prevent reuse: Alternatively, the remove path should defensively check pointer validity. Best regards, Gyujeong Jin (Giunash)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |