From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id C7C6A8017D for ; Tue, 10 Nov 2026 16:32:35 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AAGVG4k016178; Tue, 10 Nov 2026 19:31:17 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AAGVG4k016178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794328280; bh=eE9jIlsn5T5K8WAK6D+SRVh/1LjJ63jUDTR93eAV6XA=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=dOCg5x9+cMPZ81C3sirmrKdkC59m3Op31zzcCDHOgHBdPxbHzYx9KGY5zFv6XLy8F cq2Tu12Q44HmoR3R/JvMg+V0Oohw2gh3WZ6MGySxInZ2MmZOEMoOW24BIHLM3gtSIs CLPFAXpZfx3edKj/oXfE6nbgVetX/mjFP3M1CQFNi6HaKJyiOsW8LrvDQW6dDyxMaA Nf+TZU//OzOZ2YBdBwetrGYXRWRLhG1detsHfR/RmK2aVYwcyd/prdEYb9FqDLrcQm 9I0SpSNp7jFBbRdC01mBGNSxNQkfhKP7qQKAYSVhKsPstr1IMl5YNCTF99sAjpcrxN VbRXWgVy1MFxg== Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AAGVElM016174 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 10 Nov 2026 19:31:14 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AAGVElM016174 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="Zvk2DUl6" Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48e0461e040so1767407f8f.0 for ; Tue, 10 Nov 2026 08:31:14 -0800 (PST) X-Gm-Message-State: APuU4Z/vHJTl7rrE8iOdqs5So00/TKFWYDOIK1VoNHdJ3itHmNP8oAoi D21xOK06dBKkH8HyDI/aUaDYF8dLqq/CCnTisvbeePGie3htG3VGYbfmA053jBU6abRkj/Y9DlJ crByIF0xjJpj4xGx84H31g2p0RWKtg/+T2VmBVjfMLbfbbjp67FPkSQ== X-Gm-Gg: AYBFou3ujs6HQU4z/1rmS/mZrJSKb7QGpUGFgqp4ETJrjc2caVLWjOasjHKdzGFt/rI TEM5DgDb8Xm6kDMs68atLutoorb88bSDX3PLEABslbhq1P1otOhmi1WEYStqm00bvPvkJKaQCS9 TUe8uvGWY8ONbtSP/dIVWOYvDry4/wxTUEhNX4WFuoCAwrBmzOh6gChE/xKRqH2i3X7P9OEgEkq iKVqimtD6oDY4+/HDasDkf9bUz0wLh18IcTOCEaCpwpObeciJCk4Knz73FY/vaugXGuyKqi6hzz adxUVEDJSA== X-Received: by 2002:a05:6000:4006:b0:498:a72d:c097 with SMTP id ffacd0b85a97d-498a73d0414mr4929478f8f.19.1794328274280; Tue, 10 Nov 2026 08:31:14 -0800 (PST) X-Received: by 2002:a05:6000:4006:b0:498:a72d:c097 with SMTP id ffacd0b85a97d-498a73d0414mr4929420f8f.19.1794328273847; Tue, 10 Nov 2026 08:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794328273; cv=none; d=google.com; s=arc-20260327; b=l5gXMo5LvBYuJvf6jH6RHDtG3TRcDhCZVa1jkSCBCZR4o2x7JpCR4lXhT7EKaIvjSD 6fTQlNq5qi4GeTi1WOiFIkK287akKA3dcne8n7nes0k4vTFqWZtTzeBqSYoYKuXyvge3 N2LKwJdmt9nIbapC28FiDvN8fhrJe4TakIxiU6sTSsWXtj8GMKNpWaxVpUQ5HXHZxtbo gkjjUC+hkYBPoQZ2iPTBc0IxidgZ1Z/z14+s8QPcHti4/WWYQ3oLTupcQRob2O8w/rg9 zWkwOrm9r5707l4yea19xFYhTtoQYggQB+a7qY+7xdZnjNjJSjb0F49UC5kHz4rR5AjF zPew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=mCAdiBzC7vhubxopXQa9WxthE04FHbTT7qfANX/h/Bo=; fh=ozrYJQ1t3QIP6s65KBq5xgJxiFM2qf+5wwn3ABTusyU=; b=Y54T51SSi2mP806/JPSsn5LL9OqYnBg1zLw4jID9lVP0cxKVU2LhE5sz8kyslw2wiH 7H/I4glRpw0qFs8OvCiuSREor6V2BaopMPjzs0XrCZdcs82i8a9wfGzic0SARYwV+Ll4 cPX6rmYdVZIGKWF7wm8lcp2otFVDksXz9SZ6hIJMQ45iC4ivMXdwqNKhPiISnaDnueDp 8ifaIGX0bt+8XDi5EkzaBRe+F3sQ1BgLhmH7RtTeLKYlo7M7N5UopkdhI/de3QE4qvLS mHPSLrVvWA9Daipi47iamJYCcB33rI70c/b0VreIRQDhMbAvT9SYbfgNTIW4FNnxKS8F u86w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=Zvk2DUl6; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-49835e20814sor627680f8f.13.2026.11.10.08.31.13 for (Google Transport Security); Tue, 10 Nov 2026 08:31:13 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af as permitted sender) client-ip=2a06:5b06:b600:300:4f78:6441:d0f1:22af; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=Zvk2DUl6; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1794328273; x=1794933073; darn=openvz.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=mCAdiBzC7vhubxopXQa9WxthE04FHbTT7qfANX/h/Bo=; b=Zvk2DUl6co9fvHbvgb4h8zK63FdfIpGi5kG6douZGD5YAA6WorXZVGKr9F88rwPPvI A5IvPo+6ASNhJTzGUXiImeOqRmWNp2gx3fA8KVNYuNKF0AOpmuXp01WtEh7QJZR5KDcP zc7sqPn8wjx8swFNjLZVXeQ1RcYF066YjB3CNBv4J+NGay+EyLQs5fl/HCXzM1QxxDyr O/7MsIr7hVibPZ2ZHjNPA81LUfv8bz14x6d0BSlydGVK6D9MJcqTAWnGpFu1sGulejxX vbKCsRSgZgmVQMbGECaSznsJMA97mPM1kCETlI8K2cq/+nUIyRQ2JdtFim8h8ihbjjuv XgJg== X-Received: by 2002:a05:6000:1acd:b0:48f:bb92:c5a7 with SMTP id ffacd0b85a97d-4982ecf612cmr6337275f8f.9.1794328273273; Tue, 10 Nov 2026 08:31:13 -0800 (PST) Received: from athena.sw.ru ([2a06:5b06:b600:300:4f78:6441:d0f1:22af]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-499823761f5sm379125f8f.2.2026.11.10.08.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 08:31:12 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Tue, 10 Nov 2026 17:31:10 +0100 Message-ID: <20261110163110.2776207-1-den@openvz.org> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1] net/ip_gre: fix a host panic on a received ERSPAN packet X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Denis V. Lunev Commit a1049e020cdf ("ve/net/gre: Disable ERSPAN support in ip_gre module") compiled erspan_net_ops out under CONFIG_VE but left the ERSPAN receive and ICMP error paths in place. erspan_net_id is then never assigned and stays 0, and net_generic(net, 0) does not return NULL: it returns the length word of struct net_generic, which ptr[0] overlays. ip_tunnel_lookup() passes its NULL check and reads itn->tunnels[] in the first page. Once ip_gre is loaded, any GRE packet with protocol ETH_P_ERSPAN or ETH_P_ERSPAN2 delivered to the node panics it in softirq, and so does an ICMP error quoting such a header. The packet can come from the network or from container root with a raw socket. Return a NULL itn for ERSPAN under CONFIG_VE, so both paths miss the lookup and handle the packet as one for a tunnel that does not exist. Fixes: a1049e020cdf ("ve/net/gre: Disable ERSPAN support in ip_gre module") https://virtuozzo.atlassian.net/browse/VSTOR-154362 Feature: net: disable ERSPAN support in ip_gre module Signed-off-by: Denis V. Lunev --- net/ipv4/ip_gre.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index f618aae25033..c84548eebf80 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -120,8 +120,21 @@ static void erspan_build_header(struct sk_buff *skb, static unsigned int ipgre_net_id __read_mostly; static unsigned int gre_tap_net_id __read_mostly; +#ifdef CONFIG_VE +/* erspan_net_ops is compiled out, there is no erspan pernet state */ +static struct ip_tunnel_net *erspan_itn(struct net *net) +{ + return NULL; +} +#else static unsigned int erspan_net_id __read_mostly; +static struct ip_tunnel_net *erspan_itn(struct net *net) +{ + return net_generic(net, erspan_net_id); +} +#endif + static int ipgre_err(struct sk_buff *skb, u32 info, const struct tnl_ptk_info *tpi) { @@ -151,7 +164,7 @@ static int ipgre_err(struct sk_buff *skb, u32 info, itn = net_generic(net, gre_tap_net_id); else if (tpi->proto == htons(ETH_P_ERSPAN) || tpi->proto == htons(ETH_P_ERSPAN2)) - itn = net_generic(net, erspan_net_id); + itn = erspan_itn(net); else itn = net_generic(net, ipgre_net_id); @@ -279,7 +292,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, ip_tunnel_flags_copy(flags, tpi->flags); - itn = net_generic(net, erspan_net_id); + itn = erspan_itn(net); iph = ip_hdr(skb); if (is_erspan_type1(gre_hdr_len)) { ver = 0; -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel