In the Linux kernel, the following vulnerability has been resolved:
xprtrdma: serialize unmap_sync with xprt_disconnect
frwr_unmap_sync() posts LOCAL_INV Work Requests to the QP and waits
for the matching CQE. This can race with rpcrdma_xprt_disconnect():
<pre>
1. frwr_unmap_sync() samples r_xprt->rx_ep
2. rpcrdma_xprt_disconnect() drains the QP
3. frwr_unmap_sync() posts LOCAL_INV WRs after the drain
4. No CQE arrives, so wait_for_completion() blocks indefinitely
</pre>
The hung task appears in the rpciod workqueue:
Workqueue: rpciod rpc_async_schedule [sunrpc]
wait_for_completion()
frwr_unmap_sync()
xprt_rdma_free()
xprt_release()
Serialize synchronous MR invalidation against QP teardown with
rx_unmap_rwsem. frwr_unmap_sync() holds the read side while it builds
and submits the LOCAL_INV chain. Disconnect holds the write side across
QP drain and resource teardown. Drop the read side before waiting so
disconnect can drain the submitted Work Requests and deliver their CQEs.
Disconnect can reset a request while frwr_unmap_sync() waits for the
read side. Recheck rl_registered after acquiring the rwsem and return
without posting if the request has already been reset.
Move the synchronous invalidation completion from the final MR to the
request, whose lifetime covers xprt_rdma_free(). This allows disconnect
to destroy MRs after draining the QP while frwr_unmap_sync() is still
waiting. On a post failure, call rpcrdma_force_disconnect() before
dropping the read side so the endpoint is not dereferenced after
disconnect can run.
frwr_unmap_async() runs inline from Receive completion processing.
rpcrdma_xprt_drain() drains the Receive Queue before the Send Queue, so
asynchronous LOCAL_INV Work Requests are submitted before Send Queue
drain. frwr_unmap_sync(), however, runs from xprt_rdma_free() after the
transport send lock has been released, so it is not ordered against
disconnect.
Tested on v7.4-rc1 under pNFS load with repeated data server restarts
to provoke rapid QP disconnect/reconnect cycling. Without the fix, a
hung task in frwr_unmap_sync() reproduced twice in six attempts. With
the fix, no hang occurred across 200 cycles.
Also observed on v6.8 and v6.18.34.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8
AV:N - A remote NFS/RDMA peer raises RDMA_CM_EVENT_DISCONNECTED in rpcrdma_cm_event_handler(), which calls rpcrdma_force_disconnect() and xprt_rdma_close() into rpcrdma_xprt_disconnect(). That drain races frwr_unmap_sync(), entered from rpciod rpc_async_schedule() through xprt_release() and xprt_rdma_free() while req->rl_registered still holds MRs, so the client is wedged by the peer's disconnect.
AC:L - The peer opens the window by dropping the connection during in-flight chunked I/O: rpcrdma_xprt_disconnect() reaches ib_drain_sq() between frwr_unmap_sync()'s snapshot of rx_ep and its ib_post_send() of the LOCAL_INV chain taken from rl_registered. Repeating that disconnect hits the interleaving, as in two of six data-server restarts under pNFS load.
PR:N - The disconnect that races frwr_unmap_sync() is taken in rpcrdma_cm_event_handler() on RDMA_CM_EVENT_DISCONNECTED from the connected peer, before any RPC credential check, and xprt_rdma_free() then runs in the client's rpciod. No local account or capability is required.
UI:N - With an NFS-over-RDMA session already up, the peer triggers the race by disconnecting while the client releases an RPC that still has MRs on rl_registered. No further mount, signal, or administrator action is required.
S:U - The stuck rpciod waiter and the kfree of rpcrdma_mr remain inside the client kernel's xprtrdma/sunrpc authority and do not cross a guest-to-host, IOMMU, or sandbox boundary.
C:H - frwr_unmap_sync() waits on mr->mr_linv_done, which lives in the rpcrdma_mr that rpcrdma_xprt_disconnect() frees through rpcrdma_mrs_destroy() and frwr_mr_release()'s kfree(). ib_post_send() and the waiter then consume that freed completion and mr_invwr, so reclaim exposes kernel heap contents.
I:H - wait_for_completion() links the rpciod task onto mr->mr_linv_done after rpcrdma_mrs_destroy() can kfree the MR, and ib_post_send() reads mr->mr_invwr from that same object. Reclaim corrupts the wait-list and LOCAL_INV work request, which is a kernel memory write.
A:H - A LOCAL_INV posted after rpcrdma_xprt_drain()'s ib_drain_sq() produces no CQE, so wait_for_completion() in frwr_unmap_sync() never returns and pins an rpciod worker, matching the reported hung task. Freeing the MR under that waiter also crashes the transport.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:N - A remote NFS/RDMA peer raises RDMA_CM_EVENT_DISCONNECTED in rpcrdma_cm_event_handler(), which calls rpcrdma_force_disconnect() and xprt_rdma_close() into rpcrdma_xprt_disconnect(). That drain races frwr_unmap_sync(), entered from rpciod rpc_async_schedule() through xprt_release() and xprt_rdma_free() while req->rl_registered still holds MRs, so the client is wedged by the peer's disconnect.
AC:L - The peer opens the window by dropping the connection during in-flight chunked I/O: rpcrdma_xprt_disconnect() reaches ib_drain_sq() between frwr_unmap_sync()'s snapshot of rx_ep and its ib_post_send() of the LOCAL_INV chain taken from rl_registered. Repeating that disconnect hits the interleaving, as in two of six data-server restarts under pNFS load.
PR:N - The disconnect that races frwr_unmap_sync() is taken in rpcrdma_cm_event_handler() on RDMA_CM_EVENT_DISCONNECTED from the connected peer, before any RPC credential check, and xprt_rdma_free() then runs in the client's rpciod. No local account or capability is required.
UI:N - With an NFS-over-RDMA session already up, the peer triggers the race by disconnecting while the client releases an RPC that still has MRs on rl_registered. No further mount, signal, or administrator action is required.
S:U - The stuck rpciod waiter and the kfree of rpcrdma_mr remain inside the client kernel's xprtrdma/sunrpc authority and do not cross a guest-to-host, IOMMU, or sandbox boundary.
C:H - frwr_unmap_sync() waits on mr->mr_linv_done, which lives in the rpcrdma_mr that rpcrdma_xprt_disconnect() frees through rpcrdma_mrs_destroy() and frwr_mr_release()'s kfree(). ib_post_send() and the waiter then consume that freed completion and mr_invwr, so reclaim exposes kernel heap contents.
I:H - wait_for_completion() links the rpciod task onto mr->mr_linv_done after rpcrdma_mrs_destroy() can kfree the MR, and ib_post_send() reads mr->mr_invwr from that same object. Reclaim corrupts the wait-list and LOCAL_INV work request, which is a kernel memory write.
A:H - A LOCAL_INV posted after rpcrdma_xprt_drain()'s ib_drain_sq() produces no CQE, so wait_for_completion() in frwr_unmap_sync() never returns and pins an rpciod worker, matching the reported hung task. Freeing the MR under that waiter also crashes the transport.
CVSS 3.1