Article View: linux.kernel.netdev
Article #3242Re: [PATCH net] calipso: update payload_len when removing the CALIPSO option
From: Paul Moore
Date: Wed, 14 Oct 2026 13:39
Date: Wed, 14 Oct 2026 13:39
47 lines
11291 bytes
11291 bytes
On Wed, Oct 7, 2026 at 4:45 PM Eric Dumazet <edumazet@kernel.org> wrote:
> Le mer. 7 oct. 2026 à 17:26, Joas Antonio dos Santos
> <joasantonio108@gmail.com> a écrit :
> >
> > 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.
> >
> > Adjust payload_len after the header is moved.
> >
> > Fixes: 2917f57b6bc1 ("calipso: Allow the lsm to label the skbuff directly.")
> > Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
> > Assisted-by: Claude:claude-opus-5-5
> > ---
> > Found by code review. Compile-tested only (arm64, W=1); not runtime-tested.
>
> The analysis looks right to me, but this means removing the label on
> the forward path has been broken since 2016 for every packet that is
> not resegmented later (SYN, UDP, ICMPv6...).
I'm going to follow-up with a review on the v2 posting but I just
wanted to add a quick comment that while basic CALIPSO labeling is
tested via an automated test job, this particular code path is not
part of the automated testing. Improvements to the tests are always
welcome.
https://github.com/SELinuxProject/selinux-testsuite
https://github.com/SELinuxProject/selinux-testsuite/tree/main/tests/inet_socket
--
paul-moore.com
Technical Details
Message-ID:
<CAHC9VhT5w3K1MvmP=1Mxf6KKWZD5BbK14bVHJGYFN93080j5jg@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346292-linux-kernel-netdev=dewy.ruReferences:
<179138670045.80227.16292613517250896744@gmail.com> <CAL4WiirbJrQThGS4BUo=a=AV9ckJk2AyedO8AgJgozjHOwu5Vw@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346292-linux-kernel-netdev=dewy.ru
From: paul@paul-moore.com (Paul Moore)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] calipso: update payload_len when removing the CALIPSO option
Date: Wed, 14 Oct 2026 09:39:02 -0400
Organization: Usenet Network
Message-ID: <CAHC9VhT5w3K1MvmP=1Mxf6KKWZD5BbK14bVHJGYFN93080j5jg@mail.gmail.com>
References: <179138670045.80227.16292613517250896744@gmail.com> <CAL4WiirbJrQThGS4BUo=a=AV9ckJk2AyedO8AgJgozjHOwu5Vw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="2304808"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FspZiBskNtRifffk4RkQnmIFpL8= sha256:7uZG5i9VT9atWciyHFGx0xvYEiwO2fIfPI6hEaSMaAg=
sha1:BsGl8BC9GGoPRZkVyie5BfVQwgo= sha256:S4eSP0aZUCnu1FxFWZCDWxr9zYmFDfKcdj4nm4bPII0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 6D471110118; Wed, 14 Oct 2026 16:46:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.749
X-Spam-Status: No, score=-0.749 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=paul-moore.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 8D_0Gsnxev7e;
Wed, 14 Oct 2026 16:46:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-346292-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=paul-moore.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 8F6B51100F2; Wed, 14 Oct 2026 16:46:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by tor.lore.kernel.org (Postfix) with ESMTP id 35893366F9; Wed, 14 Oct 2026 13:41:43 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A27BF521895;
Wed, 14 Oct 2026 13:39:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.b="Okg5AC82"
X-Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E065751D51F
for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 13:39:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.215.175
X-ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791985159; cv=pass; b=DNuYpgTO4lTxFI7dMnC3eVSQJT2wETiMJEN+bvyVyP0LFC0b2RBafvr7KP2XUlBfacLjs0JJXZ3CKxI2BBIVPgIBc07sWDsdeizZ5YRFQtMN+9QInQ7LjAkYKw1m6WfoBMyREr6LAw+ZUlwtv3yLAB7PL6dRLJ992IzCD266DDA=
X-ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791985159; c=relaxed/simple;
bh=Do9GJSHJpFcW9ngUtQfrvC4whS6LlUvXOjfDqOxXyQk=;
h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
To:Cc:Content-Type; b=YZzc9R6551Q5urIibaZZ2NbKtWWHY9cF2yZ7YlsETk3oFEP4ASnhbQ4pFgDb2JXEzgOx231B8VUQwRp+mgKmKTTDT5i8rTR7ofmBIfPC8NIO+Vp+4HpOY7qM948oRMzqCSlcGHKxhdPQLQTY4U2hXYpv5AnVMWv4EwsXFNUX9zc=
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=paul-moore.com; spf=pass smtp.mailfrom=paul-moore.com; dkim=pass (2048-bit key) header.d=paul-moore.com header.i=@paul-moore.com header.b=Okg5AC82; arc=pass smtp.client-ip=209.85.215.175
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=paul-moore.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paul-moore.com
X-Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-cd5e2d696e0so724246a12.1
for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 06:39:17 -0700 (PDT)
X-ARC-Seal: i=1; a=rsa-sha256; t=1791985157; cv=none;
d=google.com; s=arc-20260327;
b=tDYqgBWe6NP9Mp4Y/0rDG0VuaHbLoc0Kuu0A1MaeQSZi1S8oPNB5PVxsvwnjqcrJkh
HjPWwIXgg1jJOQWZR+COLi2Ko6tA6ON+XOeqFCADUBw3ibI0VGDiyyxjxTEXFHvRla2F
fpEVhZBPU5lCGWUdeehkk3EG1h9aKrJ2qKJWI8JF0mlBIYkOL535UALtlawwHgiTbLGh
ACuc0STxfJJcCesIUH3qvH7SKf+STmKFeudjtPu4YuSFPt8uI54mJ6evoqa2MtzDXmNx
jo0Y4wneQn+y8cClOShIZh3zB1gquW4oGUDGwh8vK4SnjFnjMEcBrnfBTb1V1Z+r6muc
beFQ==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:dkim-signature;
bh=U8jbQ8jR2CLMXltfdllAESeZcdCWDCj/wLLhk4ndzVs=;
fh=L/mW3demSFQjeGpAHaKGR00p0oVE6TEUUqBUvOHfDJc=;
b=EZQSgEtUfgk0vokYrItMgyUT7LlSZv7iVkhROC0Jl4Rw8kXoTaxwXe42MXuBD88p+O
7gTZix3egdTSnQPjtsY8/7GTfLqzpFjiNQSFO1kdw/Qit0nI22M/cCiEfpFpnh+Vq7rz
90r5ZE4cLqcPQZuhixtEhORzi+8KiOvHWZ+dAxw3vUbMOp40MI0cdR1Gz6sZS7Zc8PVS
TNylodC7Al1zilASnXu3J8fWa77zl7Jpba6Uap9Q0hyKT6J5G8oCQPzGtmOXoJSiRROa
eHk8Q8a2tDAvGduoNPSsl3ETM/2evosn0+g6W6/h5Qnm/l0qHKbOoxb2fqnUHJ1oTzFj
tN/Q==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=paul-moore.com; s=google; t=1791985157; x=1792589957; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=U8jbQ8jR2CLMXltfdllAESeZcdCWDCj/wLLhk4ndzVs=;
b=Okg5AC82e4NFZFA9coJWwxesOOIKLy7WqvIK8cn4z97zP34unYpGqaZIwtMVN/rbE3
WgmYdIJ4CVTw0LqPWNLsNT2ZtePV+0EMFvGpUK554+6V0/OKY8Sq3oLm/sPGr3Knwpcf
WnSFDvwLjO7COUd2u6QwkAABKpC510CKEf08c+42LomJJuUKBx7ZpXwCgy8gPbS3pDd4
YHNTumUyxNXOAzhG74DFAf82tWMXJhgKp7zjK/oQfS8c50XiO1y3I4Ln8WTAWFCjCrH8
YgDwjRU31NvsHT5Od6vglOYQBLnjkoSnzl8pqUTRtPx2PUSPKFiwIadEp6bIkL4fOxBy
kHsw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1791985157; x=1792589957;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=U8jbQ8jR2CLMXltfdllAESeZcdCWDCj/wLLhk4ndzVs=;
b=XmHjK0vUwo3Us4JWXYn7xPKPT9cqfOQI2rgSUEhX8cTNg7TWC8GFhjofQ5L01t7+6U
sTU/tRwLasKkVeo12LbhHB1CKv7M9zfjqJXpDQT6MYC9f7YEhSmSBZ/Ts5BcADoRyUVX
RrT4CvhOyBqr0hpdKYlpvgTI8jW013CHVApi//HympfhG9Q2SOXjZ2LRMVTy3a5i/SDQ
QPHT38V0BdaLzvHo0gQn7J52Vc9s45Rb4wHva+gk8/mn1xYNTvQhxI4vku2ZmF1rxum6
Dun9nT2Ao19bJf0fY/zinXPd6RV62i3S4iT2KDofJd1kjP7BCoIcYgC6R/jCQqmyQPAY
Hq7Q==
X-Forwarded-Encrypted: i=1; AKwUvBx4fWh8JVnSoIJnoxO0N8ntmD4Po2OTXrW2wXkBPQKrAS9ETikvuEF4PzZ1WYi32U3GHO4H+Jc=@vger.kernel.org
X-Gm-Message-State: AFq9FYJPjWQIUXbWXsr1l5bZ6+BgXBIxftLDxnnKg0mLG9ILw7Nj1H4E
I+3hNl5NqDaOWm6w2dZ4YEwX/9MbMaT6Gym9tU0qi5N5MPWKBhKrvAjiE0X/2qTiYmYvi5PBZgr
MbDcNNt9kofTevpUhAxz0IbDq1ArXNd+HNmr2sEiOfsFsnhc+SpQy1h2J
X-Gm-Gg: AYBFou11vRWN6n/pIelDxcy0aT9wl3rrJ2NEqrwL8fScK1jjyu52l9sxEWIObMWE82F
qBEfnOQ2d5/JGxy/eTLueIZAuNQc0xkVaaF+3nwmzW2kV/KMEWgigZoy6PKrN8+NCG5HmpJNpQV
9ben50AHTNfqOVK8IQOBf5NkbZyarL2CfrSUXiM5gg1okf2GgndziL0UZo3sE9Gr9ekiO5QklQ4
147Rl8nR4m9i3awrbqPwNFb1r/qrg6HAVa+g4YcPsnEC4eDFDiL8prl1erGJwojHq43HJZYHjxl
1AfVGGrR5ZtKFwn77QdBnGma5S3JUptz0GB0kR/mpL6u+fL+re+1/IwV9ozX2coZFZsX83eVjTa
ckEBrw7m/nU4=
X-Received: by 2002:a05:6a21:3a93:b0:3de:4662:16f3 with SMTP id
adf61e73a8af0-3e16bed388emr12712043637.50.1791985154402; Wed, 14 Oct 2026
06:39:14 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <CAL4WiirbJrQThGS4BUo=a=AV9ckJk2AyedO8AgJgozjHOwu5Vw@mail.gmail.com>
X-Gm-Features: AclHuK8AkUpNImhF-LHJr3XzRnL-uuVSv_ZOVg-oORi05OKdAiHssAdOH-8pRvA
X-Cc: "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, netdev@vger.kernel.org,
linux-security-module@vger.kernel.org,
Alice Mikityanska <alice.kernel@fastmail.im>