Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Dust Li <dust.li@linux.alibaba.com>
To: Qican Ma <goonsomeway@gmail.com>,
	alibuda@linux.alibaba.com, sidraya@linux.ibm.com,
	mjambigi@linux.ibm.com
Cc: tonylu@linux.alibaba.com, guwen@linux.alibaba.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, linux-rdma@vger.kernel.org,
	linux-s390@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net] net/smc: validate peer CDC cursors against buffer bounds and window
Date: Tue, 24 Nov 2026 12:16:03 +0800	[thread overview]
Message-ID: <awUPgw3EGv7ATYRS@linux.alibaba.com> (raw)
In-Reply-To: <CA+OT+ON4Lt9mLvWPK8rUaHKZ01_p0fGCiCsWHwXWzT1sGaTtLA@mail.gmail.com>

On 2026-11-23 19:21:01, Qican Ma wrote:
>smc_cdc_cursor_to_host() only checks cursor monotonicity and
>smcd_cdc_msg_to_host() copies peer cursors without any validation. Neither
>verifies that prod.count < conn->rmb_desc->len or
>cons.count < conn->peer_rmbe_size, nor that the resulting cursor deltas
>stay within available buffer capacity. A malformed or malicious peer CDC
>message can therefore:
>
>1. Drive conn->urg_curs.count past conn->rmb_desc->len in
>   smc_cdc_handle_urg_data_arrival(), causing an out-of-bounds read from
>   conn->rmb_desc->cpu_addr exposed via recvmsg(MSG_OOB).
>2. Inflate conn->bytes_to_rcv past conn->rmb_desc->len (either via an
>   out-of-range prod.count or repeated wrap increments), causing the
>   second chunk iteration in smc_rx_recvmsg() to copy past the end of
>   rcvbuf_base.
>3. On SMC-D dmb_nocopy links, inflate conn->sndbuf_space past
>   conn->sndbuf_desc->len, causing the second chunk iteration in
>   smc_tx_sendmsg() to write past the end of sndbuf_base.
>
>Decode incoming CDC messages into a temporary smc_host_cdc_msg and verify
>both cursor offsets and their deltas against rmb_desc->len,
>peer_rmbe_size, and (for dmb_nocopy) sndbuf_desc->len before committing
>the update to conn->local_rx_ctrl.

Have you checked this patch ?
https://lore.kernel.org/netdev/20261112-b4-disp-0287c16e-v9-0-e5e8fa688177@proton.me

Best regards,
Dust

>
>Found with an LLM-assisted code review tool and verified by inspection on
>v7.4-rc4 (b6a9fa34ce4). Build-tested only; not runtime-tested due to lack
>of an SMC-R/SMC-D setup.

You can test using SMC-R & rxe + veth

Best regards,
Dust


      reply	other threads:[~2026-11-24  4:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  3:21 [PATCH net] net/smc: validate peer CDC cursors against buffer bounds and window Qican Ma
2026-11-24  4:16 ` Dust Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awUPgw3EGv7ATYRS@linux.alibaba.com \
    --to=dust.li@linux.alibaba.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=goonsomeway@gmail.com \
    --cc=guwen@linux.alibaba.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjambigi@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox