RDMA/rxe: Zero the AtomicETH compare field in fetch-and-add requests
Subsystems (2)
PATCH 1/1 RDMA/rxe: Zero the AtomicETH compare field in fetch-and-add requests
init_req_packet() fills the AtomicETH compare field for compare-and-swap requests but leaves it unwritten for fetch-and-add requests. The field is eight bytes in the transmitted packet.
With init_on_alloc=0, all 200 fetch-and-add requests captured between two rxe devices had nonzero bytes in that field, including printable text. After this change, all 200 had zero there. Compare-and-swap requests sent their compare value before and after the change.
Set the unused compare field to zero when constructing fetch-and-add requests.
The issue was found by Claude Opus 5.5 while checking rxe for other unzeroed memory, as Zhu Yanjun asked in his review of the rxe_mmap_info patch. The fix and this changelog were drafted with OpenAI GPT-6 (Codex) and reviewed by me.
---
A reproducer is available on request.
drivers/infiniband/sw/rxe/rxe_req.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/sw/rxe/rxe_req.c +1 -0
@@ -483,6 +483,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,atmeth_set_comp (pkt, ibwr->wr.atomic.compare_add); }else {atmeth_set_swap_add (pkt, ibwr->wr.atomic.compare_add); +atmeth_set_comp (pkt,0 ); }atmeth_set_rkey (pkt, ibwr->wr.atomic.rkey); }
Signature · 1 line
2.43.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 12 lines
init_req_packet()fills the AtomicETH compare field for compare-and-swap requests but leaves it unwritten for fetch-and-add requests. The field is eight bytes in the transmitted packet.With init_on_alloc=0, all 200 fetch-and-add requests captured between two rxe devices had nonzero bytes in that field, including printable text. After this change, all 200 had zero there. Compare-and-swap requests sent their compare value before and after the change.
Set the unused compare field to zero when constructing fetch-and-add requests.
Quoted 8 lines
The issue was found by Claude Opus 5.5 while checking rxe for other unzeroed memory, as Zhu Yanjun asked in his review of the
rxe_mmap_infopatch. The fix and this changelog were drafted with OpenAI GPT-6 (Codex) and reviewed by me.Fixes 8700e3e7c485 ("Soft RoCE driver")Signed-off-by Andrew Stellman <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 12 lines · Andrew Stellman
init_req_packet()fills the AtomicETH compare field for compare-and-swap requests but leaves it unwritten for fetch-and-add requests. The field is eight bytes in the transmitted packet.With init_on_alloc=0, all 200 fetch-and-add requests captured between two rxe devices had nonzero bytes in that field, including printable text. After this change, all 200 had zero there. Compare-and-swap requests sent their compare value before and after the change.
Set the unused compare field to zero when constructing fetch-and-add requests.
Quoted 8 lines
The issue was found by Claude Opus 5.5 while checking rxe for other unzeroed memory, as Zhu Yanjun asked in his review of the
rxe_mmap_infopatch. The fix and this changelog were drafted with OpenAI GPT-6 (Codex) and reviewed by me.Fixes 8700e3e7c485 ("Soft RoCE driver")Signed-off-by Andrew Stellman <[email protected]>
Thanks a lot. I am fine with this commit.
Zhu Yanjun
Quoted 18 lines
---
A reproducer is available on request.drivers/infiniband/sw/rxe/rxe_req.c | 1 + 1 file changed, 1 insertion(+)drivers/infiniband/sw/rxe/rxe_req.c +1
-0@@ -483,6 +483,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,atmeth_set_comp (pkt, ibwr->wr.atomic.compare_add); }else {atmeth_set_swap_add (pkt, ibwr->wr.atomic.compare_add); +atmeth_set_comp (pkt,0 ); }atmeth_set_rkey (pkt, ibwr->wr.atomic.rkey); }
Leon Romanovsky
AppliedQuoted 10 lines · Andrew Stellman
init_req_packet()fills the AtomicETH compare field for compare-and-swap requests but leaves it unwritten for fetch-and-add requests. The field is eight bytes in the transmitted packet.With init_on_alloc=0, all 200 fetch-and-add requests captured between two rxe devices had nonzero bytes in that field, including printable text. After this change, all 200 had zero there. Compare-and-swap requests sent their compare value before and after the change.
[...]
Applied, thanks!
[1/1] RDMA/rxe: Zero the AtomicETH compare field in fetch-and-add requests
https://git.kernel.org/rdma/rdma/c/d24184a64765d7
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>