From baf4547d9adbff25ec0cf6967c3859b6af2c3740 Mon Sep 17 00:00:00 2001 From: Stuart Ray <88628337+Stuartwastaken@users.noreply.github.com> Date: Sat, 14 Nov 2026 13:13:31 -0600 Subject: [PATCH] Don't split IP-reassembled packets in homa_softirq homa_softirq assumed that any frag_list was a batch built by Homa's GRO and processed each entry as a separate Homa packet. IP reassembly also leaves fragments on frag_list, and those are pieces of one packet: their bytes are counted in the head's len, their payload was parsed as Homa headers, and their dev is NULL, so dev_net crashed in homa_dispatch_pkts. Any remote host can send fragmented Homa packets, and in the stripped build, which has no GRO, every frag_list comes from reassembly. Homa's GRO doesn't add batched packets to the head's len, so split the list only when skb->len == skb_pagelen(skb). --- homa_plumbing.c | 10 +++++++--- test/unit_homa_plumbing.c | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/homa_plumbing.c b/homa_plumbing.c index 65109a05..7667ce18 100644 --- a/homa_plumbing.c +++ b/homa_plumbing.c @@ -1677,11 +1677,15 @@ int homa_softirq(struct sk_buff *skb) * skb_shinfo(skb)->frag_list by the Homa GRO mechanism. Make a * pass through the list to process all of the short packets, * leaving the longer packets in the list. Also, perform various - * prep/cleanup/error checking functions. + * prep/cleanup/error checking functions. IP reassembly can also + * leave a frag_list, but in that case the frag_list is part of + * this packet (its length is included in skb->len), so leave it. */ tt_record("homa_softirq starting"); - skb->next = skb_shinfo(skb)->frag_list; - skb_shinfo(skb)->frag_list = NULL; + if (skb->len == skb_pagelen(skb)) { + skb->next = skb_shinfo(skb)->frag_list; + skb_shinfo(skb)->frag_list = NULL; + } packets = skb; prev_link = &packets; for (skb = packets; skb; skb = next) { diff --git a/test/unit_homa_plumbing.c b/test/unit_homa_plumbing.c index f99bd551..099a3577 100644 --- a/test/unit_homa_plumbing.c +++ b/test/unit_homa_plumbing.c @@ -1767,6 +1767,32 @@ TEST_F(homa_plumbing, homa_softirq__per_rpc_batching) "sk->sk_data_ready invoked", unit_log_get()); } +TEST_F(homa_plumbing, homa_softirq__frag_list_from_ip_reassembly) +{ + struct sk_buff *skb, *skb2; + struct homa_rpc *srpc; + + /* skb2 has a Homa header, but it is just payload in the + * reassembled packet, so it must not be processed separately. + */ + self->data.common.sender_id = cpu_to_be64(5000); + skb2 = mock_skb_alloc(self->client_ip, self->server_ip, + &self->data.common, 400, 0); + skb2->dev = NULL; + self->data.common.sender_id = cpu_to_be64(self->client_id); + skb = mock_skb_alloc(self->client_ip, self->server_ip, + &self->data.common, 1000, 0); + skb_shinfo(skb)->frag_list = skb2; + skb->len += skb2->len; + skb->data_len += skb2->len; + homa_softirq(skb); + unit_log_clear(); + unit_log_active_ids(&self->hsk); + EXPECT_STREQ("1235", unit_log_get()); + srpc = list_first_entry(&self->hsk.active_rpcs, struct homa_rpc, + active_links); + EXPECT_EQ(10000 - 1000 - skb2->len, srpc->msgin.bytes_remaining); +} TEST_F(homa_plumbing, homa_err_handler_v4__port_unreachable) {