Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Allison Henderson <achender@kernel.org>
To: Greg Marsden <greg.marsden@oracle.com>
Cc: kuba@kernel.org, netdev@vger.kernel.org,
	linux-rdma@vger.kernel.org,  rds-devel@oss.oracle.com
Subject: Re: [PATCH net] net/rds: fix tcp stream corruption with large pages
Date: Sun, 06 Sep 2026 07:44:01 -0700	[thread overview]
Message-ID: <6cd13a40ffaf62bfb9b967bdd4dd28a38af3e7b1.camel@kernel.org> (raw)
In-Reply-To: <apxJjxvStibPI0AS@oracle.com>

On Sat, 2026-09-05 at 10:00 -0700, Greg Marsden wrote:
> rds_message_map_pages() assigns PAGE_SIZE bytes to every
> scatterlist entry, even when total_len ends in a partial page. The RDS
> congestion map is defined as 8192 bytes, so on systems with PAGE_SIZE
> greater than 8192 the scatterlist maps bytes beyond the end of the
> congestion map.  RDS-TCP transmits the SG contents according to those
> lengths, so the extra bytes become part of the TCP RDS stream and are
> interpreted as subsequent RDS message headers, corrupting the stream.
> 
> Limit the final scatterlist mapping to the number of bytes remaining.
> This has no effect on systems with a 4K page size and allows RDS-TCP to
> be used on systems with 16K and larger page sizes.  
> 
> The RDS selftest, which previously hung on 16K pages, now passes.
> 
> Fixes: 7875e18e0996 ("RDS: Message parsing")
> Signed-off-by: Greg Marsden <greg.marsden@oracle.com>

Looks good, thanks for the catch!
Reviewed-by: Allison Henderson <achender@kernel.org>

> ---
>  net/rds/message.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/rds/message.c b/net/rds/message.c
> index f25f2592586f..47d5e9ab9b10 100644
> --- a/net/rds/message.c
> +++ b/net/rds/message.c
> @@ -431,7 +431,9 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
>  	for (i = 0; i < rm->data.op_nents; ++i) {
>  		sg_set_page(&rm->data.op_sg[i],
>  				virt_to_page((void *)page_addrs[i]),
> -				PAGE_SIZE, 0);
> +				i == rm->data.op_nents - 1
> +					? total_len - (i * PAGE_SIZE)
> +					: PAGE_SIZE, 0);
>  	}
>  
>  	return rm;


  reply	other threads:[~2026-09-06 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05 17:00 [PATCH net] net/rds: fix tcp stream corruption with large pages Greg Marsden
2026-09-06 14:44 ` Allison Henderson [this message]
2026-09-10 15:30 ` patchwork-bot+netdevbpf

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=6cd13a40ffaf62bfb9b967bdd4dd28a38af3e7b1.camel@kernel.org \
    --to=achender@kernel.org \
    --cc=greg.marsden@oracle.com \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.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