From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CE8F13B293 for ; Fri, 15 May 2026 14:24:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778855041; cv=none; b=IOBFyry9Y2UYrJHfy/6o7u7NeEbbatOHBuINLE4FbFbsieOsGb1AEgZcXRQ/zxvkf21xdII4S9kzlNr8e1BZ62bPlcGt59SKTP54px2NfdBkv8WXd6Ol722OlLl/O937mtv8ZFbPOf4Vk07e/ajSinod4BA1wKUtqNNCWsgArEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778855041; c=relaxed/simple; bh=8tMd4kBQi6Hy9PmLRVOHEXCV4eeVaKBxaPfChs5q6/o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: In-Reply-To:Content-Type:Content-Disposition; b=fdVGmJzrvw7VLp+iuwe42ufgqZxSKGObPtmsum7Mp0JFG0KL9sI+zrpoCGuQk3+/pofeCqcJFzOXvfFJr9nBb1Z+TAy3/646pUei+gtK8kpyuhs5Fk8CJFQ2InN7arpKYohLIQh+yAvpAd/GeIV9Q1c2EbtgA7L+fCPI20N+1IY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CXjxnACs; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CXjxnACs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778855039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lIVZ/gYLJQUpRzC6abUVWLp7JCDoikQOBxMDIsDaUrM=; b=CXjxnACs22vjibw4orU1K+aJe1+7zoyB9xZ1nLDoq/XIwADT/+yQ0PQdhSMcNqBb4asMjE Eu/DiWKS2yfmtvO9TZittt3PBTjKJS/usJ6tz49tRHLLaCCz39QiFuDSu4yshncC6jEwCe 1Xvu3heLzf0H+NrgOV/xKA38jc2iwIc= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-mGnjvsAJMgSpmupyYqdMbw-1; Fri, 15 May 2026 10:23:58 -0400 X-MC-Unique: mGnjvsAJMgSpmupyYqdMbw-1 X-Mimecast-MFC-AGG-ID: mGnjvsAJMgSpmupyYqdMbw_1778855038 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-90fb1490e2cso698009785a.2 for ; Fri, 15 May 2026 07:23:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778855038; x=1779459838; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lIVZ/gYLJQUpRzC6abUVWLp7JCDoikQOBxMDIsDaUrM=; b=m2iO8tv1aWgSS6L/5y7eI3lOndAff0s6mvKlFrzx0FtvufoevW/kCiuxW+Wk9uHaCi O0sAnRrk7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a:ac0a:b0:912:61f8:cab1 with SMTP id af79cd13be357-91261f8d5b2mr222477085a.25.1778855037713; Fri, 15 May 2026 07:23:57 -0700 (PDT) X-Received: by 2002:a05:620a:ac0a:b0:912:61f8:cab1 with SMTP id af79cd13be357-91261f8d5b2mr222472385a.25.1778855037128; Fri, 15 May 2026 07:23:57 -0700 (PDT) Received: from leonardi-redhat ([176.206.19.176]) by smtp.gmail.com with ESMTPSA id af79cd13be357-910bd620fbcsm570309485a.42.2026.05.15.07.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 07:23:56 -0700 (PDT) Date: Fri, 15 May 2026 16:23:53 +0200 From: Luigi Leonardi To: stable@vger.kernel.org Cc: Stefano Garzarella , Eric Dumazet , Arseniy Krasnov , Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , virtualization@lists.linux.dev, Jakub Kicinski Subject: Re: [PATCH] vsock/virtio: fix potential unbounded skb queue Message-ID: References: <20260515-dumazet-v1-1-73468c902889@redhat.com> Precedence: bulk X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20260515-dumazet-v1-1-73468c902889@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: RyXUN4U9fc2YejAPBVQWzrjOtLm9J0DbdWDzFh8LCHI_1778855038 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, May 15, 2026 at 04:22:12PM +0200, Luigi Leonardi wrote: >From: Eric Dumazet > >Upstream commit 059b7dbd20a6f0c539a45ddff1573cb8946685b5 > >virtio_transport_inc_rx_pkt() checks vvs->rx_bytes + len > vvs->buf_alloc. > >virtio_transport_recv_enqueue() skips coalescing for packets >with VIRTIO_VSOCK_SEQ_EOM. > >If fed with packets with len == 0 and VIRTIO_VSOCK_SEQ_EOM, >a very large number of packets can be queued >because vvs->rx_bytes stays at 0. > >Fix this by estimating the skb metadata size: > > (Number of skbs in the queue) * SKB_TRUESIZE(0) > >Fixes: 077706165717 ("virtio/vsock: don't use skbuff state to account credit") >Signed-off-by: Eric Dumazet >Cc: Arseniy Krasnov >Cc: Stefan Hajnoczi >Cc: Stefano Garzarella >Cc: Michael S. Tsirkin >Cc: Jason Wang >Cc: Xuan Zhuo >Cc: Eugenio Pérez >Cc: virtualization@lists.linux.dev >Link: https://patch.msgid.link/20260430122653.554058-1-edumazet@google.com >Signed-off-by: Jakub Kicinski >[LL: Fixed conflict since this tree does not use buf_used added by commit > 45ca7e9f0730 ("vsock/virtio: fix `rx_bytes` accounting for stream sockets")] >Signed-off-by: Luigi Leonardi >--- > net/vmw_vsock/virtio_transport_common.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c >index 4c374c36c29d..86e3051d000e 100644 >--- a/net/vmw_vsock/virtio_transport_common.c >+++ b/net/vmw_vsock/virtio_transport_common.c >@@ -283,7 +283,9 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, > static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, > u32 len) > { >- if (vvs->rx_bytes + len > vvs->buf_alloc) >+ u64 skb_overhead = (skb_queue_len(&vvs->rx_queue) + 1) * SKB_TRUESIZE(0); >+ >+ if (skb_overhead + vvs->rx_bytes + len > vvs->buf_alloc) > return false; > > vvs->rx_bytes += len; > >--- >base-commit: 3b9f64db049687c0d38b4b3ef2f297f0642179af >change-id: 20260515-dumazet-07c0c855a9e2 > >Best regards, >-- >Luigi Leonardi > Forgot to add this is material for 6.6.y stable tree. Luigi