Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Bryam Vargas <hexlabsecurity@proton.me>
To: Hidayath Khan <hidayath@linux.ibm.com>
Cc: Simon Horman <horms@kernel.org>,
	Wenjia Zhang <wenjia@linux.ibm.com>,
	"D . Wythe" <alibuda@linux.alibaba.com>,
	Dust Li <dust.li@linux.alibaba.com>,
	Sidraya Jayagond <sidraya@linux.ibm.com>,
	Mahanta Jambigi <mjambigi@linux.ibm.com>,
	Wen Gu <guwen@linux.alibaba.com>,
	Tony Lu <tonylu@linux.alibaba.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Ibrahim Hashimov <security@auditcode.ai>,
	netdev@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net/smc: abort the connection when the peer overruns the RMB
Date: Thu, 08 Oct 2026 09:50:41 +0000	[thread overview]
Message-ID: <20261008095036.269598-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <dbb06d1d-17cc-4316-8efc-8e27c9bbef2e@linux.ibm.com>

Hidayath,

Sorry this sat for two months -- a major earthquake here, then
wrapping up my postgrad program.

> Yes, please send the logs.

Log below, from today's re-run on v7.3-rc6. One note on the label
first: it isn't stable across runs. My Aug 8 mail said
slab-out-of-bounds, which is what the Jul 23 run printed; the Jul 11
run said slab-use-after-free and today's says use-after-free, all on
the same 327520-byte read (5 * len). The second chunk is read from ring
offset 0, so its first 65504 bytes are still inside the RMB and the
remaining 262016 run past it, and KASAN names it after whatever sits
past the RMB. If the commit message names the bug type, take it from
the log you paste.

Repro: two AF_SMC sockets over SMC-D loopback, v7.3-rc6 with KASAN,
rmb_desc->len 65504. The sender puts its producer cursor on the wire
as wrap++ with count 0, six times. Each CDC passes every per-cursor
bound and smc_curs_diff() returns len for each, so bytes_to_rcv
reaches 393024 (6 * len). recv() returns 393024 and the second chunk
is a 327520-byte read:

  BUG: KASAN: use-after-free in _copy_to_iter+0x183/0x1390
  Read of size 327520 at addr ffff88814a0f0020 by task smc_forge_test/1695
  Call Trace:
   _copy_to_iter+0x183/0x1390
   smc_rx_recvmsg+0xbe0/0x27a0 [smc]
   smc_recvmsg+0x1c9/0x3a0 [smc]
   sock_recvmsg+0x14b/0x190
   __sys_recvfrom+0x190/0x2a0
   __x64_sys_recvfrom+0xdb/0x1b0
   do_syscall_64+0xdd/0x4a0
   entry_SYSCALL_64_after_hwframe+0x77/0x7f
  The buggy address belongs to the physical page:
  head: order:4 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
  Memory state around the buggy address:
   ffff88814a0fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  >ffff88814a100000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Trimmed: KASAN's own frames, the "?" frames, registers and the page
dump; full log on request. With our v6 cursor series applied (2/3
bounds the receive length) the same run returns 65504 and KASAN stays
quiet, and an unforged transfer is clean. I haven't run it against
your patch. FWIW the forging is a test knob on the sender; on the rx
side the test module only adds a read-only readback of bytes_to_rcv,
which the test polls instead of sleeping, and a clamp toggle that
stays off in this run.

Ibrahim Hashimov raised the same accumulator gap on his "validate peer
CDC cursor" thread in July and accepted the Suggested-by I offered him
for the follow-up I had planned then. Your patch covers that
follow-up, so I'm passing it on; your call:

https://lore.kernel.org/all/20260724072117.73038-1-security@auditcode.ai/

Of the two changes of mine you planned to rebase on, "net/smc:
unregister the connection before draining the rx tasklet" is in
mainline (36cdf5d48ca1), and "net/smc: order the CDC receive path
against buffer publication" is not merged; its last posting is v4:

https://lore.kernel.org/all/20260728-b4-disp-52ee4e7d-v4-1-0dda94b0f397@proton.me/

Thanks,
Bryam


      reply	other threads:[~2026-10-08  9:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08  8:12 [PATCH net-next] net/smc: abort the connection when the peer overruns the RMB Bryam Vargas
2026-08-11 17:39 ` Hidayath Khan
2026-10-08  9:50   ` Bryam Vargas [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=20261008095036.269598-1-hexlabsecurity@proton.me \
    --to=hexlabsecurity@proton.me \
    --cc=alibuda@linux.alibaba.com \
    --cc=dust.li@linux.alibaba.com \
    --cc=guwen@linux.alibaba.com \
    --cc=hidayath@linux.ibm.com \
    --cc=horms@kernel.org \
    --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=pabeni@redhat.com \
    --cc=security@auditcode.ai \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=wenjia@linux.ibm.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