All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtualization@lists.linux.dev, "Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH net-next v2 3/7] um: vector: trim skbs before verifying the header
Date: Fri, 16 Oct 2026 12:42:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-174318@kernel.org> (raw)
In-Reply-To: <d9ac3420f95c5953227d80c71ebc3cd7e3c5fd9c.1792067836.git.mst@redhat.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] net: vector: integer underflow in pskb_trim leads to info leak
- [High] um: vector: OOB read and packet corruption in vector_legacy_rx
--

commit 7f2cd5c3a1fb41cfaea6c03500daa85a7433a386
Author: Michael S. Tsirkin <mst@redhat.com>

um: vector: trim skbs before verifying the header

This commit modifies the vector receive path to trim the SKB before verifying
the transport header. This is done to prepare for computing the packet
checksum in software, which requires the packet to be trimmed correctly.

> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index 8a70b3a625537..1afbef78df725 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c
> @@ -865,6 +865,7 @@ static int vector_legacy_rx(struct vector_private *vp)
>  
>  	if (skb != NULL) {
>  		if (pkt_len > vp->header_size) {
> +			pskb_trim(skb, pkt_len - vp->rx_header_size);

[Severity: High]
Can this subtraction underflow if pkt_len is smaller than vp->rx_header_size?

For GRE and L2TPv3 over IPv4, vp->rx_header_size (e.g., 24) is strictly
greater than vp->header_size (e.g., 4). If a packet is received with a
length between these two values (e.g., 20 bytes), the check
pkt_len > vp->header_size passes, but pkt_len - vp->rx_header_size
underflows to a very large unsigned value.

Because the length would exceed the pre-allocated skb->len, pskb_trim() fails
silently. The SKB retains its maximum allocated size containing uninitialized
memory.

If vp->verify_header() randomly succeeds on the undersized IOV buffer,
could this leak uninitialized kernel memory up the network stack via
napi_gro_receive()?

[Severity: High]
Does this sequence cause an out-of-bounds read and inner packet corruption?

Earlier in vector_legacy_rx(), iov[0].iov_len is restricted to
vp->header_size:

	if (vp->header_size > 0) {
		iov[0].iov_base = vp->header_rxbuffer;
		iov[0].iov_len = vp->header_size;
	}

For raw IPv4 GRE/L2TPv3 tunnels where vp->header_size (4) differs from
vp->rx_header_size (24), recvmsg() reads only the first 4 bytes of the IP
header into vp->header_rxbuffer. The remaining IP header, GRE header, and
inner packet spill into iov[1] (skb->data).

When gre_verify_header() runs, it advances its pointer by
sizeof(struct iphdr) and reads uninitialized memory from the 4-byte
header_rxbuffer to verify the header.

Additionally, because the headers spilled into the SKB, does trimming by
the full vp->rx_header_size here incorrectly truncate the payload from
the tail instead of the head, silently destroying the inner packet
before it reaches eth_type_trans()?

[ ... ]

> @@ -981,6 +981,8 @@ static int vector_mmsg_rx(struct vector_private *vp, int budget)
>  	for (i = 0; i < packet_count; i++) {
>  		skb = (*skbuff_vector);
>  		if (mmsg_vector->msg_len > vp->header_size) {
> +			pskb_trim(skb,
> +				mmsg_vector->msg_len - vp->rx_header_size);

[Severity: High]
Like the vector_legacy_rx() path, does this subtraction also underflow if
msg_len is between vp->header_size and vp->rx_header_size?

>  			if (vp->header_size > 0) {
>  				header_check = vp->verify_header(
>  					mmsg_vector->msg_hdr.msg_iov->iov_base,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1792067836.git.mst@redhat.com?part=3

  reply	other threads:[~2026-10-16 12:42 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 12:41 [PATCH net-next v2 0/7] more virtio-net csum hardening Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 1/7] net: account for ingress-resolved virtio net hdr state Michael S. Tsirkin
2026-10-16 12:42   ` sashiko-bot
2026-10-15 12:41 ` [PATCH net-next v2 2/7] um: vector: honor virtio net hdr conversion failures Michael S. Tsirkin
2026-10-15 12:47   ` Johannes Berg
2026-10-15 12:52     ` Michael S. Tsirkin
2026-10-15 12:55       ` Johannes Berg
2026-10-16  9:37         ` Michael S. Tsirkin
2026-10-16  9:43         ` Michael S. Tsirkin
2026-10-16  9:44           ` Johannes Berg
2026-10-16  9:47             ` Michael S. Tsirkin
2026-10-16  9:49               ` Johannes Berg
2026-10-16  9:53                 ` Michael S. Tsirkin
2026-10-15 17:19   ` Willem de Bruijn
2026-10-16  9:40     ` Michael S. Tsirkin
2026-10-16 12:42   ` sashiko-bot
2026-10-15 12:41 ` [PATCH net-next v2 3/7] um: vector: trim skbs before verifying the header Michael S. Tsirkin
2026-10-16 12:42   ` sashiko-bot [this message]
2026-10-15 12:41 ` [PATCH net-next v2 4/7] net: resolve uncommon partial checksums at ingress Michael S. Tsirkin
2026-10-15 17:43   ` Willem de Bruijn
2026-10-15 19:18     ` Chris Arges
2026-10-16  9:34       ` Michael S. Tsirkin
2026-10-16  9:36     ` Michael S. Tsirkin
2026-10-15 18:04   ` Willem de Bruijn
2026-10-15 18:07   ` Willem de Bruijn
2026-10-16 10:02   ` Michael S. Tsirkin
2026-10-16 12:42   ` sashiko-bot
2026-10-15 12:41 ` [PATCH net-next v2 5/7] net: add a sysctl to opt out of virtio net hdr checksum validation Michael S. Tsirkin
2026-10-15 17:50   ` Willem de Bruijn
2026-10-16  9:33     ` Michael S. Tsirkin
2026-10-16 15:30       ` Willem de Bruijn
2026-10-16 17:51         ` Michael S. Tsirkin
2026-10-16 18:19           ` Willem de Bruijn
2026-10-16 18:40             ` Michael S. Tsirkin
2026-10-17  1:09               ` Willem de Bruijn
2026-10-16 17:55         ` Michael S. Tsirkin
2026-10-16 18:17           ` Willem de Bruijn
2026-10-16 12:42   ` sashiko-bot
2026-10-15 12:41 ` [PATCH net-next v2 6/7] net: add ip4_parse() Michael S. Tsirkin
2026-10-15 18:51   ` Phil Sutter
2026-10-16 11:56   ` Björn Töpel
2026-10-16 12:42   ` sashiko-bot
2026-10-15 12:41 ` [PATCH net-next v2 7/7] virtio_net: cleanup protocol calculation Michael S. Tsirkin
2026-10-16 11:52   ` Björn Töpel
2026-10-16 12:42   ` sashiko-bot
2026-10-15 19:21 ` [PATCH net-next v2 0/7] more virtio-net csum hardening Chris Arges

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=sashiko-outbox-174318@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --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 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.