The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dust Li <dust.li@linux.alibaba.com>
To: Piyus Kedia <piyus@iiitd.ac.in>,
	alibuda@linux.alibaba.com,
	Sidraya Jayagond <sidraya@linux.ibm.com>,
	Mahanta Jambigi <mjambigi@linux.ibm.com>,
	netdev@vger.kernel.org
Cc: Tony Lu <tonylu@linux.alibaba.com>,
	Wen Gu <guwen@linux.alibaba.com>,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Kapil Vaswani <kapil@presceralabs.ai>
Subject: Re: [PATCH net v2] net/smc: validate the peer's CDC cursors against our own buffers
Date: Sun, 22 Nov 2026 21:39:20 +0800	[thread overview]
Message-ID: <awLwiDzVpdJOr6BZ@linux.alibaba.com> (raw)
In-Reply-To: <20261122042120.2430434-1-piyus@iiitd.ac.in>

On 2026-11-22 09:51:20, Piyus Kedia wrote:
>A peer's CDC message carries two cursors that are offsets into buffers
>described on this side: the producer cursor counts the bytes the peer has
>written into the RMB we published to it, and the consumer cursor the bytes
>it has taken from the RMB it published to us.  Neither is checked, on either
>transport.
>
>smcr_cdc_msg_to_host() and smcd_cdc_msg_to_host() copy both into the
>connection as they arrive, and every later user treats them as trustworthy:
>
> - smc_cdc_msg_recv_action() adds the producer difference to
>   conn->bytes_to_rcv under a comment asserting
>   "guarantee 0 <= bytes_to_rcv <= rmb_desc->len", which nothing enforces;
> - smc_cdc_handle_urg_data_arrival() reads
>   *(base + conn->urg_curs.count - 1), an unbounded index into the RMB;
> - smc_rx_recvmsg() clamps only the first of its two ring chunks
>   (rmb_desc->len - cons.count) and uses the remainder unclamped for the
>   second, so bytes_to_rcv becomes a copy length;
> - smc_rx_splice() walks PAGE_ALIGN(len + offset) / PAGE_SIZE pages calling
>   vmalloc_to_page() without checking the result, and get_page() then
>   dereferences NULL once the walk passes the end of the RMB.

I think Bryam's patch is solving the same problem here:
https://lore.kernel.org/netdev/20261112-b4-disp-0287c16e-v9-0-e5e8fa688177@proton.me

Best regards,
Dust


  reply	other threads:[~2026-11-22 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  4:21 [PATCH net v2] net/smc: validate the peer's CDC cursors against our own buffers Piyus Kedia
2026-11-22 13:39 ` Dust Li [this message]
2026-11-22 14:06   ` Piyus Kedia

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=awLwiDzVpdJOr6BZ@linux.alibaba.com \
    --to=dust.li@linux.alibaba.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=guwen@linux.alibaba.com \
    --cc=kapil@presceralabs.ai \
    --cc=linux-kernel@vger.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=piyus@iiitd.ac.in \
    --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