From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.70 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795998853; b=cxmIrLd2HD3CdEns03QgCfvswC1ELnnF4JU9gQ3dd4lW3AhC7tj/EOgs/M7BTVwUowoi ws+BI++nqeUKtSqsqTy1uqCaY15WzdgvAnstqwzz6pHJN917RAjIlL5de9Y/TB7FqrQ+m NSODmp7jAU8hdZix+ewYLqxXB4SY0+dgyf0INqKGiba3jG7qd0ZRQdwq8WoL+U1Ck97Un LRAvL/t2FBMQMvOActZPE345l0MFiVdPpGlzw/LvyvUhhbReWZTctO9Pf7HlHvB5XKPAY pjtXLbg1sOhu4WHuQcDoT6y1vxyQOXLZWhmljx3saFdS57gJeoaGHNyjN8ECDG/YCLw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795998853; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=OifBpZwnWd7Ep4Uj9tF7hAcuQIcqntifHMEKr4SrEWY=; b=XzpXWMmY7MRI78ygOe90Jti3U369PHpP9YrRwtNbea8LVGV1OSkCgyCARoP5Eh22bWgC 1btmZiE2MzJCkv1zU0O04eTk+/uf+niTfAzPrN5CIsAxiXm7cP83xkchmmlbe4C3rK92U eYacW7d+THy/Q8cBm0Lyiy65oyImevvEHEefwS3ffDomDye+68gan8Lp4K8gMgVFkeGbB 10tz5HxbA8OOJ2SJqFlmCVJ5CXk6BsC3BPIbZhCHuPSUS7/W5hnn+wetb4F5YYIwu2SJx yZAMP9p3Sx1cnWvuLX6t/ZI4QdK7aOzFQzh2j6m9w78tI2NJ6RnTkXroY5HFgMlFm2Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b="Kar/LYmJ"; arc=none smtp.remote-ip=209.85.216.70 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5234606A325 for ; Mon, 30 Nov 2026 00:34:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C5234606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=Kar/LYmJ Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-3b4232374d6so13295163a91.2 for ; Sun, 29 Nov 2026 16:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1795998852; x=1796603652; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OifBpZwnWd7Ep4Uj9tF7hAcuQIcqntifHMEKr4SrEWY=; b=Kar/LYmJZbutR36hp+W7NpxurCCBzmavBx3Uq8qxpeit8uyyKQUEV/fShvTyci9m9V /CGBXVi/uam0FRkMJ4gS37MYiQElWdovjQarxpBg5kL/kkpjKWFf9s3a19+cfJOdmVIL 5Y95vZZl6xtQRb0pV9X9w2TTrAAw2qJazJjBYDnClxw9dzE8C325v6tgFVRLxIjY3Xbq AqUWhsXoXtEX96urpU6NKGwtypAiclTE+cbYo+19zrECAchBVLO4gfEtgXE80g43MDVA n/QZPaWaxQvqc1j87+6xHab5qwkbdNLrVR+vgMU6ZrjwaBW/ZhGqb81tKqapf6Si32RR hnig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795998852; x=1796603652; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OifBpZwnWd7Ep4Uj9tF7hAcuQIcqntifHMEKr4SrEWY=; b=cgiVFBRHGn+PUPI92Mqzc4iYHCO1tXgqQfpyqTuALRlXsE7zyaskNBKaFdZkQPGmkl 9sfMQwgjzW76O9OszVWNZL7IHlyuAOZsGTZtT7nhtEzU+AfVWF0KHroknrL1BMm65YOm hI4wQSrt6ptjTX4bagv8HxxncBcGj1rgdpCMKKm88IZe5G30t8CUH1jywzVCv2TOaGQ6 N3GpmZedWbIJnDJVaYO7w70KDoR8MVbOuTtDY1NgndTVx94EQeUlhpcRfuEBGqJ2s8+L ghfUxvwScLPxVC/BDLTFffMdE/wQtlYoTwPQ6NS8J0BBBWCntOwZz+d2Zn9jvwMoqWpJ KbGg== X-Forwarded-Encrypted: i=1; AL+hErFqPRPqKfZlcepBvABK9r0PpsQLSQl/wy7zOtNRxmZ7J0FcfswxGnXAI4TeLStWTG9zhvK4TjQuufXGBds=@vger.kernel.org X-Gm-Message-State: APuU4Z+gNq0lpWaqfDEMbfcggul8243hpvpJS4f/tVZSaLzzymzEtPCL GZcEhohseCMvNvz5ipvneg9AvIS4LLYCt5hVGRx/ExuuAf7AEmMqyOF7dT8B+rWBvNNvOMit6zj 7i9d5QA== X-Received: from plbjf22.prod.google.com ([2002:a17:903:2696:b0:2f0:fe7f:9bf5]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3f10:b0:3b3:b8f1:f152 with SMTP id 98e67ed59e1d1-3b41c7e1414mr29827442a91.2.1795998851907; Sun, 29 Nov 2026 16:34:11 -0800 (PST) Date: Mon, 30 Nov 2026 00:34:11 +0000 In-Reply-To: <20261125124212.4145820-1-graypanda.inzag@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261125124212.4145820-1-graypanda.inzag@gmail.com> Message-ID: Subject: Re: [PATCH net] tcp: do not BUG on an unreadable urgent byte From: Kuniyuki Iwashima To: Junyoung Jang Cc: Eric Dumazet , Neal Cardwell , Gwanhyun Lee , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Mina Almasry , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" 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 > Signed-off-by: Gwanhyun Lee > Signed-off-by: Junyoung Jang Reviewed-by: Kuniyuki Iwashima