From: sashiko-bot@kernel.org
To: "Daehyeon Ko" <4ncienth@gmail.com>
Cc: "Eugenio Perez" <eperezma@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
kvm@vger.kernel.org, virtualization@lists.linux.dev
Subject: Re: [PATCH net v2] vhost/vsock: size receive SKBs from declared payload
Date: Sun, 04 Oct 2026 07:40:17 +0000 [thread overview]
Message-ID: <20261004074017.80AC11F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261004073419.4039011-1-4ncienth@gmail.com>
> vhost_vsock_alloc_skb() allocates an skb from the total guest descriptor
> length before reading hdr->len. Descriptor capacity and declared payload
> length are independent, so a guest can supply a large descriptor with a
> zero or short payload.
>
> On Linux v7.2, 455 zero-payload packets with 64 KiB descriptors retained
> 30,255,680 bytes on a 256 KiB receive buffer while rx_bytes and buf_used
> stayed zero. A full-payload control retained 265,984 bytes. The existing
> SKB_TRUESIZE(0) budget caps skb count but does not account for the
> descriptor-sized allocation.
>
> Repeating this across connections can exhaust host kernel memory.
>
> Trimming after allocation is insufficient. Linear skbs retain their full
> head, while a nonlinear payload exceeding head tailroom can retain its
> first page fragment.
>
> Copy the header into a stack object, validate hdr->len before allocating,
> and size the skb from the declared payload plus the header. This keeps the
> allocation proportional to receive accounting for both linear and
> nonlinear skbs.
>
> Use payload_len > len - sizeof(hdr) for validation. This avoids addition
> overflow on 32-bit hosts and ensures payload_len fits the subsequent
> int-length copy path.
>
> Fixes: ab9aa2f3afc2 ("vhost/vsock: Allocate nonlinear SKBs for handling large receive buffers")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Daehyeon Ko <4ncienth@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261004073419.4039011-1-4ncienth@gmail.com?part=1
next prev parent reply other threads:[~2026-10-04 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-04 7:34 [PATCH net v2] vhost/vsock: size receive SKBs from declared payload Daehyeon Ko
2026-10-04 7:38 ` netdev-bot+sinfo
2026-10-04 7:40 ` sashiko-bot [this message]
2026-10-04 16:31 ` Will Deacon
2026-10-05 7:36 ` netdev-bot+sashiko
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=20261004074017.80AC11F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=4ncienth@gmail.com \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox