From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795998853; b=EGif2+9zBTXyBubMfyHSrF1OrEPVrWLWEPfH9C6lppjYXKXIhgVWbIAVrdVix6QLW7sq eoil2J28/xHl2JXqEvQw7qDiv0Klxlf86+XuAmMyXYu9aX7IMalF0RRnAIT3UuDmnR9Lm U5E5WZppHBoen0o78RarwSPWE5aHTngi6pH/7sOiG2b9SS799sKP3wOcUJ8Zy4eHfC2+C BNGaj4AB3TU0hvpthzeHdwUpOqg/+Wr4rErjMZOY9rwYFV6bme8t06zPeuGFospK7hlrt deZYeHGM/ftwkGVIW6I+2CpNrLWJrrP3ZgbMHEMBy1DaFmTo8tmFyInESXYjChBJ8ag== 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=b8e5VQpBEjcxR52RzUj4v4SB2uPuLgn76TD21+7GPG1/XtnFHSCCROKeupShNNYmKl6a ozguM/nmY+ERIFGUwllb/6N4E6VrOsLUUAWbp24ejzQHVMnNLocguxzmpD+a1juZpaaQA wOOOgUbkE9CX7PXL0XzGlQ6HdahBLDX11WVP6YEuDHKv70f/SBEOu7Vh2dcdPy49sf8yl 01YyWI4DROu1QVTE4Wj0upqOgq5+vdo0V+CTkxGXGz/WfrXG7lhUj912IXRbpN9LyB3Cv ivcqVKs965iCquvvsu5zvbMX5HouBUvsdCxcOz1CQHK+xWDbN0i/3CkR4CQQjAEKQ3w== 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.71 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (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 C4CD9606A31C for ; Mon, 30 Nov 2026 00:34:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C4CD9606A31C 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) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=Kar/LYmJ Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-3b4b76a2b95so7901313a91.1 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=V8r7iOb2ZYwOJnk04aDMY57t3E1/FaLnH+1E3npu7S9J+KwYB9LmyTBxE+xtE6VAG4 nnZEMcWAB4HGhhes3/GIhZxFN/G8AxCac7etbmjXh3qZxH2UwJzw68qS4Fc70jXHOCwD piYQmnh6c4y1smIp142JAEHUfI9rxgg1aNUnT47zl1Ck2GWdwAdaL16xQ8shTTH1izIw a2oytCLtw9sYKSjZPG4oAjzAUTzi8eGWQa1o4pNSV5kQIw/qcn1JNkGJnp9/x0mA8fZ2 hhoWEEhns+vIq6zYtEkMvs6Lf+RGWAGEZi1rnflgoCLUCffrsyf+iUioXLOroby/uBuu d9cg== X-Forwarded-Encrypted: i=1; AL+hErFUQbkp1QPoTjMY507QaWtaned4ekGvs++Vn2eKtj4Aw1+XBDuRAdec4NsPUbyFhGyaJYhhtRg=@vger.kernel.org X-Gm-Message-State: APuU4Z+6JisiMy70HlOV/EoQ98Yar7FhFgQMogU4Swr5FoC2kRj7AJPr I3Svb+ejn6VR2XROUP4iSqcikEKjAVqC+QPBtmNOrKKo7DuJFEPhKiizDCLTHHq8jqTo8FiOFx9 YKSlsqQ== 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: netdev@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