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 BD33180063 for ; Tue, 1 Dec 2026 15:39:29 +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 6B1FcHEY020088; Tue, 1 Dec 2026 18:38:18 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6B1FcHEY020088 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="brMsmmgo" Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6B1FbsZT019975 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 1 Dec 2026 18:37:54 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6B1FbsZT019975 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-6bb639459e8so3296319a12.3 for ; Tue, 01 Dec 2026 07:37:54 -0800 (PST) X-Gm-Message-State: APuU4Z/fMQHEJR26Zq5+rUVRWiP8WI14WUyCmtSJacgP3/7VmItvhSGx pClIf1vYbQmIj7wjKhNRoGipbvskzDzN/Eei/NBP+cpmSz6xW1JqpUrKEqFgvTPBBSjXfy+qMVE YlJcsF6pHrgbDUmOA8Aav9crWihFBNDwccl86NrY9k/LAwktEU7PLcQ== X-Gm-Gg: AZFdTZcu2pTsdpWv9KM0Rr46TUr0sqpD4Zry6ITs263i70MGNMRazpf9oCQrpCD7nrI Cbfrd8upmVyk341bbxlzUgNnpL97QfNzQaJM6Hq03Ozjs4VR17WWjLcU/6Lk3/Xs3MdwUxg/ktt F310L4Y0w0Q6mVWqeOQgxotqqDoH7LYQzUaSf510jdxoaM8eC6OXd4elPpapAkaYNdif4jEqF2b BwYp0cqH37DROFVtV1Wl5HAZpt4hzTgdoh02xxcIhbpclJ5ZrZ6kdNRw3QGSBloyvc5eodWXX9c WPfTTNVbSnQv4XnpHcHFM7RUWs9iXm1LcGE++jgm+lQ9TmeWzqxjfaw+l4Y6ow0ul7UQ0Miep89 pl8JXsS8iMhzCpvW3l6K6Gtrs X-Received: by 2002:a05:6402:1ed4:b0:6ba:7eb0:a289 with SMTP id 4fb4d7f45d1cf-6ba7eb0a426mr20827607a12.12.1796139474160; Tue, 01 Dec 2026 07:37:54 -0800 (PST) X-Received: by 2002:a05:6402:1ed4:b0:6ba:7eb0:a289 with SMTP id 4fb4d7f45d1cf-6ba7eb0a426mr20827584a12.12.1796139473656; Tue, 01 Dec 2026 07:37:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796139473; cv=none; d=google.com; s=arc-20260327; b=QXGRdbBQu6FlLpXS/naKC8r4TKTYrPteaIad/VlS0IGaqobbn8a1CUcbYj0acuC+3h pT+jSYaZtevn894UtYMu4FN0GyZPdgmEExboNOnY3TTHzzQFcmeRg+uyXrrsIxTyFzb0 7NhCVtDnOwBS2hdmFo4/jlxyQJBx7jvByaJ5Ff3dOO6gYXTREl9kQZoDzapFdCZoggj3 OABbTYKVViGRui7EKryr3K++Ij7LwZ7Nxaid+HA4N1mYsJ0ShSa349pyTppjm2maKwNC 8otgDfF0zfKvPvKIVWDsOrxkfGsHi0AZmUp00CXQ8QSs4gQRBpLqJSP1551B5bAVrFYJ d+2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=NnUyLnHsdrovFY0/5Q57lRvCu/xvhbAMPtCnSuagkDo=; fh=/QSWnKFFIPNLStgUoDwCQRaXnWcMIG7fyKJgHY+VEpU=; b=jY1z7w+0aP0JFX7LR52nBHpnHDMtHSqFngFh8EImsfBXCEIs+E32OWksvP8xvEthPv 53dCjXmCMR4b0gPNmn+fFZX4BCDjQ0K8BdYwiUO+vo7en06gd9czKRkaNYL+JAyJ2SZI wjDzZnOPDmZPRhm7rf1eL0FDh5IlNjeSK/y9zSrs7FHjvlen3uPasuZt9AEF4RUkvSTz P2vS3CKgodI03O6ZBZEEB7fZ2p6Q3wKNZQRKU82d18rwOIWGeP+9H1DrwAIxJ75U9MHM NYaOx0geEzQob11JlEynJmx+rZOuQysYLgMRer7sfsjCN6Z52j9/nbRMdDNX3PvlNc19 tc9w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=brMsmmgo; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-6ba37158522si31853405a12.67.2026.12.01.07.37.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 07:37:53 -0800 (PST) Received-SPF: pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=brMsmmgo; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=NnUyLnHsdrovFY0/5Q57lRvCu/xvhbAMPtCnSuagkDo=; b=brMsmmgo3JT1 6vGhYKM3etalX6Ftsmpd0zJJATryD88zFYUKaBY/LPkOokXewUcqOYDdLsXBZgypKc5ftXCex/eNl kXtWbhlpGYybpze5GDETusHbNmKetafEjwO5MLJacZODvv7C4wbuZ0eb+RsHdj3GIBqVWy1iHZpRm gGHM8+lMCpSDHjDXSxZEc50aLc3EQnBggX/D0XWmYrNnoBQZageyt10i8Oqd+18S5CG1mczQdA367 3CqKp/O/9Cnvpj2mZVeTLyGShY5PN83wfrzEMuEWB97p56Gxa2P41B0ui8tH+jHq088MjId1OaFTw FVd/FO28WAN4cVybtgiZBg==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xYPvA-0081OE-1z; Tue, 01 Dec 2026 16:37:43 +0100 From: Eva Kurchatova To: khorenko@virtuozzo.com, vladimir.riabchun@virtuozzo.com Date: Tue, 1 Dec 2026 14:10:21 +0200 Message-ID: <20261201153749.2872789-7-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201153749.2872789-1-eva.kurchatova@virtuozzo.com> References: <20261201153749.2872789-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v2 06/15] ms/calipso: update payload_len when removing the CALIPSO option 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: Joas Antonio dos Santos [ Upstream commit 00accbd9d5021b942a16078bd5717d7865f6971c ] calipso_skbuff_delattr() removes the CALIPSO option from the hop-by-hop extension header, or the whole extension header if CALIPSO is its only option, and pulls the skb by the removed length. It never updates ipv6hdr->payload_len, so after a successful removal the header still claims the original length. calipso_skbuff_setattr() already adjusts payload_len by the length it adds; the delete path was missed. This is reached on the forward path when a packet carrying CALIPSO is sent to a destination mapped to an unlabeled NetLabel domain. The forwarded packet then has a payload_len larger than its real payload by the removed length (8 to 264 bytes), and the receiver drops it as truncated. So removing the label on the forward path has been broken for every packet that is not resegmented later (SYN, UDP, ICMPv6...). Adjust payload_len after the header is moved. BIG TCP packets carry payload_len == 0 (see ipv6_set_payload_len()), and ipv6_payload_len() then falls back to skb->len, so leave them alone. Tested with client, router and server network namespaces on one kernel (arm64, QEMU): SELinux permissive with a minimal mdp-generated policy (network_peer_controls=1), "netlabelctl calipso add pass doi:16", the default NetLabel mapping left unlabeled, IPv6 forwarding on the router. The client sends 5 UDP datagrams with a CALIPSO hop-by-hop option (DOI 16, set through IPV6_HOPOPTS) to the server through the router: before: router Ip6OutForwDatagrams 5, server receives 0, server Ip6InTruncatedPkts 5 after: router Ip6OutForwDatagrams 5, server receives 5, server Ip6InTruncatedPkts 0 Fixes: 2917f57b6bc1 ("calipso: Allow the lsm to label the skbuff directly.") Signed-off-by: Joas Antonio dos Santos Link: https://patch.msgid.link/179147329205.58079.5847298721173675285@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin (cherry picked from commit 8dcd1a626da5fbde8788c9ba0585881ce446642e) https://virtuozzo.atlassian.net/browse/VSTOR-157577 Feature: fix ms/net Signed-off-by: Eva Kurchatova Reviewed-by: Sashiko --- net/ipv6/calipso.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c index ea8abf987493..9e32a732ecbf 100644 --- a/net/ipv6/calipso.c +++ b/net/ipv6/calipso.c @@ -1425,6 +1425,10 @@ static int calipso_skbuff_delattr(struct sk_buff *skb) skb_pull(skb, delta); memmove((char *)ip6_hdr + delta, ip6_hdr, size); skb_reset_network_header(skb); + ip6_hdr = ipv6_hdr(skb); + /* BIG TCP packets have payload_len == 0 */ + if (ip6_hdr->payload_len) + be16_add_cpu(&ip6_hdr->payload_len, -delta); } return 0; -- 2.56.1 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel