Hi Marcelo, Xin, and netdev maintainers, While fuzzing Linux 7.4.0-rc3 (upstream commit 4405c18) on x86_64 with syzkaller, we hit a reproducible WARNING in skb_trim() (include/linux/skbuff.h:3346, WARN_ON(skb_is_nonlinear(skb))) called from sctp_ulpevent_make_rcvmsg() (net/sctp/ulpevent.c:728). We verified both torvalds/linux master (7.4.0-rc4) and linux-next, and the affected code paths remain unchanged. Summary / Root Cause Analysis ============================= An SCTP GSO skb whose "cover letter" head_skb has been partially pulled (e.g., by a TC/TCX ingress eBPF program calling bpf_skb_pull_data()) bypasses both skb_linearize() in sctp_rcv() and the frag_list switch in sctp_inq_pop(), resulting in a nonlinear skb reaching skb_trim(): 1. In sctp_rcv() (net/sctp/input.c:101, 120): bool is_gso = skb_is_gso(skb) && skb_is_gso_sctp(skb); ... if (((!is_gso || skb_cloned(skb)) && skb_linearize(skb)) || !pskb_may_pull(skb, sizeof(struct sctphdr))) goto discard_it; When is_gso is true and the skb is not cloned, sctp_rcv() skips skb_linearize(skb), leaving skb_shinfo(skb)->frag_list attached. 2. In sctp_inq_pop() (net/sctp/inqueue.c:167-184): if (skb_is_gso(chunk->skb) && skb_is_gso_sctp(chunk->skb)) { if (skb_shinfo(chunk->skb)->frag_list) chunk->head_skb = chunk->skb; /* skbs with "cover letter" */ if (chunk->head_skb && chunk->skb->data_len == chunk->skb->len) { ... chunk->skb = skb_shinfo(chunk->skb)->frag_list; } } This assumes a GSO head_skb ("cover letter") always has zero linear payload bytes remaining (data_len == len) after pulling IP and SCTP headers. However, if an ingress hook (such as a TC/TCX BPF program calling bpf_skb_pull_data(skb, 2048)) pulls bytes from frag_list[0] into head_skb's linear area beforehand, head_skb ends up with 0 < data_len < len. Consequently, data_len == len is false, and chunk->skb remains the nonlinear head_skb. 3. sctp_inq_pop() parses the first DATA chunk from head_skb and passes this nonlinear chunk->skb to sctp_ulpevent_make_rcvmsg() (net/sctp/ulpevent.c:728): skb_trim(skb, chunk->chunk_end - padding - skb->data); Because skb_is_nonlinear(skb) is true, __skb_set_length() (include/linux/skbuff.h:3346) triggers WARN_ON(skb_is_nonlinear(skb)) and returns early without trimming skb->len, leaving the cloned skb untrimmed when queued to the socket receive queue (and crashing systems running with panic_on_warn=1). Possible Fix ============ In sctp_rcv(), if an SCTP GSO skb has linear payload data alongside frag_list (or cannot be treated as a clean "cover letter" skb where skb->data_len == skb->len after pulling the SCTP header), linearize or segment it before queuing; alternatively, handle nonlinear skbs safely before calling skb_trim() in sctp_ulpevent_make_rcvmsg() (e.g., via pskb_trim() or ensuring chunk->skb is linear). Reproducer ========== A standalone ~100-line C reproducer (attaching a 4-insn SCHED_CLS program calling bpf_skb_pull_data(skb, 2048) to lo via BPF_TCX_INGRESS and sending an SCTP GSO message over loopback) deterministically triggers the WARNING immediately on a clean, untainted kernel: https://gist.github.com/ilidanZtormrage/3ac261e41d217e2ce1d3880a7ac22bad Crash Report (from clean standalone reproducer on 7.4.0-rc3) ============================================================ ------------[ cut here ]------------ skb_is_nonlinear(skb) WARNING: include/linux/skbuff.h:3346 at skb_trim+0x153/0x170, CPU#1: tcx_tmp/9402 Modules linked in: CPU: 1 UID: 0 PID: 9402 Comm: tcx_tmp Not tainted 7.4.0-rc3 #1 PREEMPT(full) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 RIP: 0010:skb_trim+0x153/0x170 Code: 5b 5d 41 5c e9 fe 77 15 f8 e8 99 1f 8f f8 e9 fb fe ff ff e8 8f 1f 8f f8 e9 40 ff ff ff e8 75 20 8f f8 eb d6 e8 de 77 15 f8 90 <0f> 0b 90 e9 ef fe ff ff e8 a0 1f 8f f8 e9 62 ff ff ff e8 96 1f 8f RSP: 0018:ffffc90010bbf2b0 EFLAGS: 00010293 RAX: 0000000000000000 RBX: ffff888023baa8c0 RCX: 0000000000000000 RDX: ffff8880262f2640 RSI: ffffffff89b0c4f2 RDI: 0000000000000005 RBP: 00000000000003b4 R08: 0000000000000000 R09: 000000000000038e R10: ffff888028ec2ee3 R11: 0000001801060478 R12: 000000000000038e R13: ffff888028ec24a8 R14: ffff88804d8de550 R15: 00000000000003c4 FS: 000000002c490380(0000) GS:ffff8880e9262000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000002c49e000 CR3: 000000004d768000 CR4: 0000000000752ef0 PKRU: 55555554 Call Trace: <TASK> sctp_ulpevent_make_rcvmsg+0x417/0xab0 sctp_ulpq_tail_data+0xc2/0xf70 sctp_do_sm+0x3b50/0x5e50 sctp_assoc_bh_rcv+0x392/0x740 sctp_inq_push+0x25c/0x310 sctp_backlog_rcv+0x169/0x590 __release_sock+0x3a4/0x440 release_sock+0x1e5/0x280 sctp_wait_for_connect+0x1f3/0x750 </TASK> Best regards, Xinyuan Zhao