Repository navigation
[Deepin-Kernel-SIG] [linux 6.6.y] [Upstream] Update kernel base to 6.6.162 - #2272
Conversation
commit 5fb756f1bbec7a3862dda5d79028bf656271804c upstream. The network statistic data in the driver is protected by RCU. Unfortunately when tearing down the queues after an error during connecting to the frontend (e.g. due to illegal Xenstore data filled in by the guest), the statistic data is being freed without synchronizing the RCU state. In case the data is being read via sysfs in this phase, access to already freed memory or memory being in new use is possible. Fix that by calling synchronize_net() before freeing the queue data. This is XSA-526 / CVE-2026-100080 Reported-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr> Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 89e534265b62c94749639350200b10370564bb3a) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
commit bfddc420afe827d9f06458cdf8087cd602f8c9cb upstream. In order for the function to legitimately avoid locking/RCU, it needs to run after all TX/RX processing has finished/stopped: Lookups happen from xenvif_start_xmit(), while adds/removes happen from xenvif_tx_action() (called out of xenvif_poll()). Move the call out of xenvif_disconnect_data() (the call to the function from connect()'s error path doesn't require any cleaning up there), and put it past the synchronization point in backend_disconnect(). This is XSA-527 / CVE-2026-100081. Fixes: b17075d ("xen-netback: fix race condition on XenBus disconnect") Reported-by: kerhunt <kerhunt@proton.me> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 0d515c409033c8e2a645a781be3ca76ab825fc8c) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
commit a02926f7c89bfc798ee9514e09694ff4279928a1 upstream. Reading I/O statistics via sysfs concurrently with tearing down a frontend device might result in UAF or a NULL dereference, as the reading of the statistics data is not synchronized with freeing the data. Use a rwlock for synchronizing. This is XSA-528 / CVE-2026-100082 Reported-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr> Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Roger Pau Monné <roger@xenproject.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit fe9ead8c5bdb752e329cecfecbdb5dfca5e9996b) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 5139929c698c273e07cb0635732f6a918a7b8e78) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewer's GuideData structuresAdd a rings lock and use it to synchronize Xen blkback ring allocation, teardown, and sysfs statistics reads.
ImplementationDefer multicast-address-list freeing until after network processing has stopped, and synchronize the error teardown path before freeing queue data.
ConfigurationBump the kernel sublevel to 6.6.162.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="drivers/net/xen-netback/xenbus.c" line_range="842" />
<code_context>
err:
if (be->vif->num_queues > 0)
xenvif_disconnect_data(be->vif); /* Clean up existing queues */
+ synchronize_net();
for (queue_index = 0; queue_index < be->vif->num_queues; ++queue_index)
xenvif_deinit_queue(&be->vif->queues[queue_index]);
</code_context>
<issue_to_address>
**Statistics can access freed queues**
When queue setup fails after at least one queue has been initialized while a statistics read begins after the grace period, `xenvif_get_stats()` can start an RCU read after `synchronize_net()` returns, observe the still-positive `vif->num_queues`, and read `vif->queues` after the error path frees it with `vfree()`. The resulting use-after-free can crash the backend.
Set `num_queues` to zero before `synchronize_net()` in the error path, while preserving the count needed to deinitialize the queues.
</issue_to_address>
### Comment 2
<location path="drivers/net/xen-netback/interface.c" line_range="813" />
<code_context>
xenvif_disconnect_queue(queue);
}
-
- xenvif_mcast_addr_list_free(vif);
}
</code_context>
<issue_to_address>
**Failed reconnect retains multicast entries**
When a guest adds multicast addresses while a queue is active and a later queue or ring fails to connect, `xenvif_disconnect_data()` now stops the queues without clearing `fe_mcast_addr`, and the connection-error path only synchronizes and deinitializes those queues. Guest-supplied multicast entries therefore survive a failed connection and are reused on a later connection, leaving stale multicast membership and potentially allowing multicast traffic to reach the guest after it unsubscribes.
Clear the multicast list on the failed-connect path after the synchronization point, or otherwise ensure it is reset before reconnecting.
</issue_to_address>| err: | ||
| if (be->vif->num_queues > 0) | ||
| xenvif_disconnect_data(be->vif); /* Clean up existing queues */ | ||
| synchronize_net(); |
There was a problem hiding this comment.
🟠 High · Statistics can access freed queues
When queue setup fails after at least one queue has been initialized while a statistics read begins after the grace period, xenvif_get_stats() can start an RCU read after synchronize_net() returns, observe the still-positive vif->num_queues, and read vif->queues after the error path frees it with vfree(). The resulting use-after-free can crash the backend.
Set num_queues to zero before synchronize_net() in the error path, while preserving the count needed to deinitialize the queues.
Prompt for AI agents
In `drivers/net/xen-netback/xenbus.c` at line 842:
**Statistics can access freed queues**
When queue setup fails after at least one queue has been initialized while a statistics read begins after the grace period, `xenvif_get_stats()` can start an RCU read after `synchronize_net()` returns, observe the still-positive `vif->num_queues`, and read `vif->queues` after the error path frees it with `vfree()`. The resulting use-after-free can crash the backend.
Set `num_queues` to zero before `synchronize_net()` in the error path, while preserving the count needed to deinitialize the queues.| xenvif_disconnect_queue(queue); | ||
| } | ||
|
|
||
| xenvif_mcast_addr_list_free(vif); |
There was a problem hiding this comment.
🟡 Medium · Failed reconnect retains multicast entries
When a guest adds multicast addresses while a queue is active and a later queue or ring fails to connect, xenvif_disconnect_data() now stops the queues without clearing fe_mcast_addr, and the connection-error path only synchronizes and deinitializes those queues. Guest-supplied multicast entries therefore survive a failed connection and are reused on a later connection, leaving stale multicast membership and potentially allowing multicast traffic to reach the guest after it unsubscribes.
Clear the multicast list on the failed-connect path after the synchronization point, or otherwise ensure it is reset before reconnecting.
Prompt for AI agents
In `drivers/net/xen-netback/interface.c` at line 813:
**Failed reconnect retains multicast entries**
When a guest adds multicast addresses while a queue is active and a later queue or ring fails to connect, `xenvif_disconnect_data()` now stops the queues without clearing `fe_mcast_addr`, and the connection-error path only synchronizes and deinitializes those queues. Guest-supplied multicast entries therefore survive a failed connection and are reused on a later connection, leaving stale multicast membership and potentially allowing multicast traffic to reach the guest after it unsubscribes.
Clear the multicast list on the failed-connect path after the synchronization point, or otherwise ensure it is reset before reconnecting.
Update kernel base to 6.6.162.
Summary by Sourcery
Update the kernel base to 6.6.162 and incorporate upstream Xen backend stability fixes.
Bug Fixes:
Enhancements: