linux/drivers/infiniband/sw/rxe
Michael Bommarito 1114c87aa6 RDMA/rxe: Reject non-8-byte ATOMIC_WRITE payloads
atomic_write_reply() at drivers/infiniband/sw/rxe/rxe_resp.c
unconditionally dereferences 8 bytes at payload_addr(pkt):

    value = *(u64 *)payload_addr(pkt);

check_rkey() previously accepted an ATOMIC_WRITE request with pktlen ==
resid == 0 because the length validation only compared pktlen against
resid. A remote initiator that sets the RETH length to 0 therefore reaches
atomic_write_reply() with a zero-byte logical payload, and the responder
reads sizeof(u64) bytes from past the logical end of the packet into
skb->head tailroom, then writes those 8 bytes into the attacker's MR via
rxe_mr_do_atomic_write(). That is a remote disclosure of 4 bytes of kernel
tailroom per probe (the other 4 bytes are the packet's own trailing ICRC).

IBA oA19-28 defines ATOMIC_WRITE as exactly 8 bytes. Anything else is
protocol-invalid. Hoist a strict length check into check_rkey() so the
responder never reaches the unchecked dereference, and keep the existing
WRITE-family length logic for the normal RDMA WRITE path.

Reproduced on mainline with an unmodified rxe driver: a sustained
zero-length ATOMIC_WRITE probe repeatedly leaks adjacent skb head-buffer
bytes into the attacker's MR, including recognisable kernel strings and
partial kernel-direct-map pointer words.  With this patch applied the
responder rejects the PDU and the MR stays all-zero.

Cc: stable@vger.kernel.org
Fixes: 034e285f8b ("RDMA/rxe: Make responder support atomic write on RC service")
Link: https://patch.msgid.link/r/20260418162141.3610201-1-michael.bommarito@gmail.com
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2026-04-28 11:41:23 -03:00
..
Kconfig RDMA/rxe: Remove 32-bit architecture support 2025-04-21 04:16:29 -04:00
Makefile RDMA/rxe: Add net namespace support for IPv4/IPv6 sockets 2026-03-30 13:47:43 -04:00
rxe_av.c
rxe_comp.c RDMA/rxe: Fix race condition in QP timer handlers 2026-01-28 05:02:30 -05:00
rxe_cq.c RDMA: Properly propagate the number of CQEs as unsigned int 2026-03-30 13:47:44 -04:00
rxe_hdr.h RDMA/rxe: Fix __bth_set_resv6a 2024-08-23 11:42:38 -03:00
rxe_hw_counters.c RDMA/rxe: Merge request and complete tasks 2024-04-22 16:54:33 -03:00
rxe_hw_counters.h RDMA/rxe: Merge request and complete tasks 2024-04-22 16:54:33 -03:00
rxe_icrc.c RDMA/rxe: switch to using the crc32 library 2025-02-09 04:20:10 -05:00
rxe_loc.h RDMA: Properly propagate the number of CQEs as unsigned int 2026-03-30 13:47:44 -04:00
rxe_mcast.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rxe_mmap.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rxe_mr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rxe_mw.c
rxe_net.c RDMA v7.1 merge window 2026-04-20 11:20:35 -07:00
rxe_net.h RDMA/rxe: Support RDMA link creation and destruction per net namespace 2026-03-30 13:47:43 -04:00
rxe_ns.c RDMA/rxe: Add net namespace support for IPv4/IPv6 sockets 2026-03-30 13:47:43 -04:00
rxe_ns.h RDMA/rxe: Add net namespace support for IPv4/IPv6 sockets 2026-03-30 13:47:43 -04:00
rxe_odp.c RDMA/rxe: Replace use of system_unbound_wq with rxe_wq 2026-03-30 13:47:43 -04:00
rxe_opcode.c
rxe_opcode.h
rxe_param.h RDMA/rxe: Remove 32-bit architecture support 2025-04-21 04:16:29 -04:00
rxe_pool.c RDMA/rxe: Fix the warning "__rxe_cleanup+0x12c/0x170 [rdma_rxe]" 2025-01-14 06:43:53 -05:00
rxe_pool.h
rxe_qp.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rxe_queue.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rxe_queue.h
rxe_recv.c RDMA/rxe: Reject unknown opcodes before ICRC processing 2026-04-28 11:37:37 -03:00
rxe_req.c RDMA/rxe: Fix race condition in QP timer handlers 2026-01-28 05:02:30 -05:00
rxe_resp.c RDMA/rxe: Reject non-8-byte ATOMIC_WRITE payloads 2026-04-28 11:41:23 -03:00
rxe_srq.c RDMA/rxe: Fix double free in rxe_srq_from_init 2026-01-15 04:59:53 -05:00
rxe_task.c RDMA/rxe: Replace use of system_unbound_wq with rxe_wq 2026-03-30 13:47:43 -04:00
rxe_task.h RDMA/rxe: Remove unused rxe_run_task 2025-04-20 11:27:39 -04:00
rxe_verbs.c RDMA: Consolidate patterns with sizeof() to ib_copy_validate_udata_in() 2026-03-31 03:11:01 -04:00
rxe_verbs.h RDMA/rxe: Generate async error for r_key violations 2026-02-24 04:56:18 -05:00
rxe.c RDMA/rxe: Support RDMA link creation and destruction per net namespace 2026-03-30 13:47:43 -04:00
rxe.h RDMA/rxe: Replace use of system_unbound_wq with rxe_wq 2026-03-30 13:47:43 -04:00