Netdev List
 help / color / mirror / Atom feed
From: Bryam Vargas <hexlabsecurity@proton.me>
To: Sidraya Jayagond <sidraya@linux.ibm.com>
Cc: Mahanta Jambigi <mjambigi@linux.ibm.com>,
	"D . Wythe" <alibuda@linux.alibaba.com>,
	Eric Dumazet <edumazet@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
	Dust Li <dust.li@linux.alibaba.com>,
	Stefan Raspl <raspl@linux.ibm.com>,
	Simon Horman <horms@kernel.org>,
	Guangguan Wang <guangguan.wang@linux.alibaba.com>,
	Wen Gu <guwen@linux.alibaba.com>,
	linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tony Lu <tonylu@linux.alibaba.com>,
	Ursula Braun <ubraun@linux.ibm.com>,
	Hidayath Khan <hidayath@linux.ibm.com>,
	Wenjia Zhang <wenjia@linux.ibm.com>
Subject: Re: [PATCH net v2 5/6] net/smc: order the urgent mark across the cursor wrap rollover
Date: Thu, 03 Dec 2026 09:17:28 +0000	[thread overview]
Message-ID: <20261203091718.486262-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <9de0921d-d01c-4cae-8ec2-7d86a3c3f438@linux.ibm.com>

On 01/12/26 1:48 pm, Sidraya Jayagond wrote:
> With a 16 KiB RMB, urg = {0, 0} and cons = {1, 16383}, this returns 1
> although the reader is 32767 bytes past the mark. It also ignores
> urg_state, so a connection that never got urgent data (urg_curs is
> zeroed) or has a stale mark can report at-mark.
[...]
> Could you fold this into v3?

Folded into 5/7 as you wrote it:
https://lore.kernel.org/all/20261203-b4-disp-ba1ad55e-v3-5-6834ff90c5d0@proton.me/

I ran your case, no urgent data and 32767 bytes read: net and v2
return 1, v3 returns 0. A valid mark 32767 bytes behind the reader
gives the same. Both halves of the check are needed. Without the state
check, the 1 is back once the reader is on wrap 65535, and with
smc_curs_diff() kept, it is back for the mark behind the reader.

The urg_rx_skip_pend operand changes the result in one case I could
find: recv(MSG_OOB) with data in front of the urgent byte, then
SO_OOBINLINE switched on, then a read up to the byte. The state is
SMC_URG_READ, the skip is pending and the reader is one byte before
the mark. v3 returns 1 there, as net and TCP do; without that operand
it returns 0.

One answer changes, and I want you to see it. After recv(MSG_OOB) of
an urgent byte with nothing in front of it, SIOCATMARK now returns 0.
net returns 1 there, and so does TCP. Without 7/7 the state is
SMC_URG_READ and no skip is pending, so the check is false. With 7/7
the reader has skipped the byte and the distance is 0. If a reader
calls recv(MSG_OOB) first and then reads until SIOCATMARK returns 1,
it keeps reading. On net that reader stops, and the sender's next
send() stalls, which is the case 7/7 fixes.

SMC already returns 0 after a read that reaches the mark: it skips the
urgent byte at that read, TCP at the next one. Returning 1 after
recv(MSG_OOB) needs one more state. After that call the state is
SMC_URG_READ and the reader is at the mark, and a new connection,
SMC_URG_READ with both cursors zero, looks the same. I left that out
of v3; it is under "Not fixed here". Is 0 fine with you there, or do
you want it handled in this series?

> Cc: stable@vger.kernel.org # depends on 2/6 and 4/6

Added, as 2/7 and 4/7.

Thanks,
Bryam

pw-bot: cr


  reply	other threads:[~2026-12-03  9:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 14:23 [PATCH net v2 0/6] net/smc: fix the failover cursor switch and wrap rollover Bryam Vargas via B4 Relay
2026-11-28 14:23 ` [PATCH net v2 1/6] net/smc: take the socket spinlock across the failover cursor switch Bryam Vargas via B4 Relay
2026-12-01  8:47   ` Sidraya Jayagond
2026-11-28 14:23 ` [PATCH net v2 2/6] net/smc: do not credit stale CDC completions after a link switch Bryam Vargas via B4 Relay
2026-12-01  9:00   ` Sidraya Jayagond
2026-12-03  9:17     ` Bryam Vargas
2026-11-28 14:23 ` [PATCH net v2 3/6] net/smc: store each cursor once in smc_switch_cursor() Bryam Vargas via B4 Relay
2026-12-01  9:03   ` Sidraya Jayagond
2026-11-28 14:23 ` [PATCH net v2 4/6] net/smc: fix the failover catch-up across the cursor wrap rollover Bryam Vargas via B4 Relay
2026-12-01  9:08   ` Sidraya Jayagond
2026-11-28 14:23 ` [PATCH net v2 5/6] net/smc: order the urgent mark " Bryam Vargas via B4 Relay
2026-12-01  8:18   ` Sidraya Jayagond
2026-12-03  9:17     ` Bryam Vargas [this message]
2026-11-28 14:23 ` [PATCH net v2 6/6] net/smc: update the urgent state under the socket spinlock Bryam Vargas via B4 Relay
2026-12-01  9:32   ` Sidraya Jayagond
2026-12-03  9:17     ` Bryam Vargas

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=20261203091718.486262-1-hexlabsecurity@proton.me \
    --to=hexlabsecurity@proton.me \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@kernel.org \
    --cc=guangguan.wang@linux.alibaba.com \
    --cc=guwen@linux.alibaba.com \
    --cc=hidayath@linux.ibm.com \
    --cc=horms@kernel.org \
    --cc=kuba@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=raspl@linux.ibm.com \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=ubraun@linux.ibm.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