All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/other Bug 2151] ip_frag: output array overflow when fragmenting mbufs over 64 KB
Date: Fri, 20 Nov 2026 18:28:46 +0000	[thread overview]
Message-ID: <bug-2151-3@https.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=2151

            Bug ID: 2151
           Summary: ip_frag: output array overflow when fragmenting mbufs
                    over 64 KB
           Product: DPDK
           Version: 26.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: major
          Priority: Normal
         Component: other
          Assignee: dev@dpdk.org
          Reporter: stephen@networkplumber.org
  Target Milestone: ---
             Group: security

```
============================================================================
ANT-2026-KAH9I4A9  [high]  CWE-197  memory-safety
ip_frag: output array overflow when fragmenting mbufs over 64 KB
Location: lib/ip_frag/rte_ipv4_fragmentation.c:159  in
rte_ipv4_fragment_packet()
Commit:   9a45341f18a1ab47af7123e63d942b90c1b79f38
============================================================================
```

A vhost guest can make a host DPDK application that fragments its packets write
past the end of the caller's `pkts_out[]` array. The written values are host
mbuf pointers, not guest-chosen data, and the guest needs only a single Tx
descriptor in the default `net_vhost` configuration. The result is stack or
adjacent-table corruption and a crash of the host data-path process. Code
execution has not been shown. Both `rte_ipv4_fragment_packet()` and
`rte_ipv6_fragment_packet()` are affected, in any application that fragments
received packets larger than the egress MTU based on `pkt_len`, as
`examples/ip_fragmentation` does.

The only check that `pkts_out[nb_pkts_out]` can hold every fragment is at
`lib/ip_frag/rte_ipv4_fragmentation.c:158-160` (and
`rte_ipv6_fragmentation.c:100`). It compares against
`(uint16_t)(pkt_in->pkt_len - header_len)`. The loop that follows walks the
whole mbuf chain and never looks at `nb_pkts_out` again. A chain of 65556 bytes
or more therefore passes the check on its low 16 bits. The function then stores
one pointer per fragment past the array and returns a count larger than
`nb_pkts_out` (45 for 16 slots), so the caller also reads those out-of-bounds
entries. The vhost dequeue path puts no upper bound on frame length unless
`linear-buffer=1` is set. A remote sender can reach the same state through a
separate defect: reassembly ignores a failed `rte_pktmbuf_trim()`. That route
also needs jumbo frames, scattered Rx, and an application that reassembles
before it fragments. The attached reproducer has a vhost-user guest send a
65557-byte IPv4 frame to a forwarder modelled on `examples/ip_fragmentation`.
ASan reports a stack-buffer-overflow WRITE past `frags[16]` at
`rte_ipv4_fragmentation.c:258`. On a plain gcc build, larger frames end in a
"stack smashing detected" abort or SIGSEGV. The truncating check dates from
4c38e5532a07 ("ip_frag: refactor IPv4 fragmentation into a proper library").

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2026-11-20 18:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=bug-2151-3@https.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /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.