All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Junyoung Jang <graypanda.inzag@gmail.com>
Cc: Eric Dumazet <edumazet@kernel.org>,
	Neal Cardwell <ncardwell@google.com>,
	 Gwanhyun Lee <gwanhyunlee@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Mina Almasry <almasrymina@google.com>,
	netdev@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] tcp: do not BUG on an unreadable urgent byte
Date: Mon, 30 Nov 2026 00:34:11 +0000	[thread overview]
Message-ID: <awzEeeArDb1tKnib@google.com> (raw)
In-Reply-To: <20261125124212.4145820-1-graypanda.inzag@gmail.com>

On Wed, 25 Nov 2026 21:42:11 +0900, Junyoung Jang wrote:
> tcp_urg() checks that the urgent byte offset is within skb->len and
> then calls skb_copy_bits(). The byte can still lie in an unreadable
> Device Memory fragment. In that case skb_copy_bits() returns -EFAULT
> and tcp_urg() calls BUG().
> 
> Mark the byte as TCP_URG_READ when the copy fails. Leaving
> TCP_URG_NOTYET pending lets a later segment retry the old urgent
> pointer: the unsigned offset can wrap into that segment's TCP header
> and return a header byte through MSG_OOB. Clearing urg_data instead
> would drop the urgent-byte hole and make ordinary recvmsg() hit
> -EFAULT on the unreadable byte. TCP_URG_READ prevents the retry and
> lets the receive path skip the hole until copied_seq passes urg_seq.
> 
> A custom LLM agent developed by the authors found this issue.
> The author manually reviewed the root cause and tested the reproducer
> and fix. A test-only netfilter module put a loopback MSG_OOB byte
> in an unreadable skb fragment. On a 7.4.0-rc2 KASAN kernel, the
> original code hit BUG(). The return-only fix avoided the BUG but let
> a later MSG_OOB read return a byte from the next TCP header. With
> this fix, that read returned -EINVAL, and a normal MSG_OOB control
> still returned its byte. A test-only KUnit case seeded TCP_URG_READ
> on a synthetic NET_IOV_DMABUF skb and confirmed that a successful
> MSG_SOCK_DEVMEM read clears it. Device Memory hardware was not tested.
> 
> Fixes: 65249feb6b3d ("net: add support for skbs with unreadable frags")
> Co-developed-by: Gwanhyun Lee <gwanhyunlee@gmail.com>
> Signed-off-by: Gwanhyun Lee <gwanhyunlee@gmail.com>
> Signed-off-by: Junyoung Jang <graypanda.inzag@gmail.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

      parent reply	other threads:[~2026-11-30  0:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 12:42 [PATCH net] tcp: do not BUG on an unreadable urgent byte Junyoung Jang
2026-11-29 13:01 ` netdev-bot+sashiko
2026-11-30  0:34 ` Kuniyuki Iwashima [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=awzEeeArDb1tKnib@google.com \
    --to=kuniyu@google.com \
    --cc=almasrymina@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=graypanda.inzag@gmail.com \
    --cc=gwanhyunlee@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.