From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B8FF4143889; Tue, 23 Apr 2024 21:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713908591; cv=none; b=Hr3kJu/A1fm0tHAnX61Wo9gWEW/eDWXl12b+i6W9Su1HSPrVHao0IE64bolRrlBqqsy3dK8x63IHZQVLD1gZ9XWSZl9Yb7m4wlqwEjdv+FJOAj6IBcSbv4XtiY/7vw2WhJTWMgrZFsWTw/i1j3vztRQqatR4WMKGjjC2apgj6qM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713908591; c=relaxed/simple; bh=yKA9sGgw9uM3qal9s57f3o5GglN8vRr+MehprDlCesw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QHle1h7EVmewb8afhUwIgUR7vHH+v10676maq9R+R/R5wirx6Oy46FT9HdPCw71MKy8KRqWe9lFIqrKWUMLG3w09mzOGp0iAnlm6gwg8N5a4cyI33UgwN5HKyKGjG+0g9ME3q4bNl7otCVoyiyk4M1o33zQLxIp4510L3uuGzus= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RJU1BGvZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RJU1BGvZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F9ACC4AF08; Tue, 23 Apr 2024 21:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1713908591; bh=yKA9sGgw9uM3qal9s57f3o5GglN8vRr+MehprDlCesw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJU1BGvZ9VsCZL+0nmPLaVTd54Sgd7ZnQbR+gSg98NQhQ4htKAjgGVNpETDq8MNft BH3oCBOW11mHjw5Xt9Pl1S6j1OkbFMG/D8AL64oWVg+xY1Up6y3yzwUEOxlpR/oMwu TwTV1ZMLuKQM+zl3d4ROv/M/QDdkMZGpwINS8PwQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuri Benditovich , Willem de Bruijn , "David S. Miller" , Sasha Levin Subject: [PATCH 6.6 044/158] net: change maximum number of UDP segments to 128 Date: Tue, 23 Apr 2024 14:38:01 -0700 Message-ID: <20240423213857.204028752@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423213855.696477232@linuxfoundation.org> References: <20240423213855.696477232@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuri Benditovich [ Upstream commit 1382e3b6a3500c245e5278c66d210c02926f804f ] The commit fc8b2a619469 ("net: more strict VIRTIO_NET_HDR_GSO_UDP_L4 validation") adds check of potential number of UDP segments vs UDP_MAX_SEGMENTS in linux/virtio_net.h. After this change certification test of USO guest-to-guest transmit on Windows driver for virtio-net device fails, for example with packet size of ~64K and mss of 536 bytes. In general the USO should not be more restrictive than TSO. Indeed, in case of unreasonably small mss a lot of segments can cause queue overflow and packet loss on the destination. Limit of 128 segments is good for any practical purpose, with minimal meaningful mss of 536 the maximal UDP packet will be divided to ~120 segments. The number of segments for UDP packets is validated vs UDP_MAX_SEGMENTS also in udp.c (v4,v6), this does not affect quest-to-guest path but does affect packets sent to host, for example. It is important to mention that UDP_MAX_SEGMENTS is kernel-only define and not available to user mode socket applications. In order to request MSS smaller than MTU the applications just uses setsockopt with SOL_UDP and UDP_SEGMENT and there is no limitations on socket API level. Fixes: fc8b2a619469 ("net: more strict VIRTIO_NET_HDR_GSO_UDP_L4 validation") Signed-off-by: Yuri Benditovich Reviewed-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/linux/udp.h | 2 +- tools/testing/selftests/net/udpgso.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/udp.h b/include/linux/udp.h index 94e63b2695406..00790bb5cbde6 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -105,7 +105,7 @@ struct udp_sock { #define udp_assign_bit(nr, sk, val) \ assign_bit(UDP_FLAGS_##nr, &udp_sk(sk)->udp_flags, val) -#define UDP_MAX_SEGMENTS (1 << 6UL) +#define UDP_MAX_SEGMENTS (1 << 7UL) #define udp_sk(ptr) container_of_const(ptr, struct udp_sock, inet.sk) diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c index 7badaf215de28..b02080d09fbc0 100644 --- a/tools/testing/selftests/net/udpgso.c +++ b/tools/testing/selftests/net/udpgso.c @@ -34,7 +34,7 @@ #endif #ifndef UDP_MAX_SEGMENTS -#define UDP_MAX_SEGMENTS (1 << 6UL) +#define UDP_MAX_SEGMENTS (1 << 7UL) #endif #define CONST_MTU_TEST 1500 -- 2.43.0