Article View: linux.kernel.netdev
Article #11777Re: [PATCH net v2] openvswitch: advance by the real header length in get_ipv6_ext_hdrs()
From: Simon Horman
Date: Thu, 05 Nov 2026 14:45
Date: Thu, 05 Nov 2026 14:45
43 lines
9951 bytes
9951 bytes
On Mon, Nov 02, 2026 at 01:45:35AM +0000, Joas Antonio dos Santos wrote:
> get_ipv6_ext_hdrs() walks the IPv6 extension header chain to fill
> key->ipv6.exthdrs, but advances to the next header with ipv6_optlen()
> whatever the current header is. That is only right for Hop-by-Hop,
> Destination Options and Routing headers:
>
> - an Authentication Header is ((hdrlen + 2) << 2) bytes long
> (ipv6_authlen()), so with hdrlen = 4 the walk skips 40 bytes instead
> of 24 and reads the next "header" from the ICV and payload;
>
> - a Fragment header is always 8 bytes, and the byte read as hdrlen is
> its Reserved field, which the sender controls and receivers ignore,
> so a non-zero value makes the walk skip up to 2048 bytes and miss
> the headers that follow;
>
> - in a non-first fragment nothing after the Fragment header is a
> header at all, it is the middle of the fragmentable part, yet the
> walk keeps parsing it as an extension header chain.
>
> In all cases the OFPIEH12_* bits stored in key->ipv6.exthdrs depend on
> bytes chosen by the sender rather than on the headers that are actually
> present: payload bytes that look like another AH or a Hop-by-Hop header
> add OFPIEH12_UNREP/OFPIEH12_UNSEQ, and real headers after a Fragment
> header can go unreported. Flows that match on OVS_KEY_ATTR_IPV6_EXTHDRS
> then classify such packets wrongly. There is no memory safety issue,
> skb_header_pointer() bounds every read.
>
> Advance by sizeof(struct frag_hdr) for Fragment headers and by
> ipv6_authlen() for AH, and stop at the Fragment header if its offset is
> non-zero, as ipv6_find_hdr() does.
>
> Fixes: 28a3f0601727 ("net: openvswitch: IPv6: Add IPv6 extension header support")
> Link: https://lore.kernel.org/all/178905555085.219967.6617611783437228045@kernel.org/
> Cc: stable@vger.kernel.org
> Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
> ---
> Changes in v2:
> - Stop the walk at a non-first fragment, nothing after its Fragment
> header is a header (Ilya).
> - Drop the Assisted-by tag (Ilya).
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261105144537.GV865646@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357451-linux-kernel-netdev=dewy.ruReferences:
<20261102-ovs-exthdrs-v2-1-21ceef6a243d@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-357451-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2] openvswitch: advance by the real header length in get_ipv6_ext_hdrs() Date: Thu, 5 Nov 2026 14:45:37 +0000 Organization: Usenet Network Message-ID: <20261105144537.GV865646@horms.kernel.org> References: <20261102-ovs-exthdrs-v2-1-21ceef6a243d@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3659623"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:xZTYIf0m/F/NXSz8ELFxUPAKZ7g= sha256:fKjTmR+i/5nABlN6gAW+ROfiXPtoNNYzsShiMj11Srw= sha1:fnipJb9epUf4yQ7LOgHr+Gjx8d8= sha256:V6Rh2SAjGuOXDCeDu6stypESWgk07TvYxeeG0BvgSsI= Content-Disposition: inline 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 4CB09112FE9; Thu, 5 Nov 2026 17:53:51 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 PzMR1YV5u85f; Thu, 5 Nov 2026 17:53:47 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-357451-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 6BFFC112FDC; Thu, 5 Nov 2026 17:53:38 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 3CD612B7E6; Thu, 5 Nov 2026 14:46:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793889963; b=2KsvnDZyOSkhseetzXSZghqybc5Tez7D4n2ZCc2W6PoJGA54YA+MrtOZbInkEXAx5Xrd zSd9PoW00OJ6KZ9gOASFtn46w4J+aiDfrkN7GP1tOQCgI5Xc0WPw1jcDvnr0wKbpllni+ 2RZLXwv7AkjWc2Jm5zhaR97kqfMdLenZBOusMZKtdqvlYmFTwxREaZ2tnJsPfddT+Ktvj GQbqlSqT6X7PldAX37zu9Lvsr2KnTVrWFZlR52d+z59P7tkC+wgZ49TpCWJHCVFUvnVrN 5MXvSPFBEvcvMtB/SL5O6q5Cvg0TNeXppkeFcV/aEcaW7adrk+fWFpd9qgGOowXcZJQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793889963; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=GXf8t6+kR4HdU5+vFSNIxt3JNXiYtbmrhcPp2vi87yk=; b=d3hUB34YlGV+4Axo5JG9CLzwbkfOWWfB48khkelc2pdxHO8TIzS5Y2IIsfKoCCdZg0PJ q2lqUsMSORkjkwE2KUxUB513AH639zwQv/NuzyV8lAWNPka6uoFRSomg3n/fORx0NM0zv tsJGwxwHnYuYWug6u18IP6Mks5p5wZslwdeyVcNMd/ejqmjdjfy2K5ggU0mRPyMRPUb74 7ttt6aiixVXILi8KHMfW/62/2CajMwzg+FiP6/2LsinUuN4d8W/wnbDynt3j7DN6WbUPT k0Pmx0ik2ds4lKg4nrEVwVWCb09Q0O8W5dwn53MxrXRI+BW7t9IRSoRPFh4iBTu1cIg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gN0fJVGr; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 133FF606A329; Thu, 5 Nov 2026 14:46:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gN0fJVGr X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793889942; b=hGbYrPM+HmVuRZyOunlkJpDS+d5MObzpbK6BqPxgq4F+VGrh8NcM4NZAjJVyr/0fmgmB eTDgZsyGgj6+Bzd+IAHY1SivJlq2HTo9wnthHoKtQgIhb6E9toh5eGnzuanmurV5ER/gs YhUQUmFOkPs+B0qt673a/0ujXbv9ghXsNKtezSJZrd9cTPnyept+2sJQDojis76NuuINJ fcwuMVvfzEEtKSf5ZQjQHlS6Kq7MkHiGX/qybx/cu+Nn359i8pSuKKs5tw8Lko6gY7nN5 qPkm78v7SRFbGqDXIn86GNFoH5v+TPpx0kZb9K1kdi/+F1caYUUMUFJoHgLvmW7kevw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793889942; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=GXf8t6+kR4HdU5+vFSNIxt3JNXiYtbmrhcPp2vi87yk=; b=5a+cK9KzuLOZEt4XqdhF7oyv6yCs1iGtNff9TxUcEwNA84PZ8JHaFVygoQDk6LmnK4Dm /ApNVMaVqcEK8W1LOAyT8TS8QjUrUym4HchlyQalIUbtOfld9SAAAAVQqqXtK0bPSRiVn 4iZ6C/gNF1+fLo8yR1FPGN2YkUganSZ2Fqlvyo3fQY0BlY7ngeZIkbsMKXFjcYYubNpOy HchzZ0AK6WztBi+FuNv4MrHZLfwh0l8PWYdZ19qyZrGvcQOLhKZLY5/wZ3cIXWy6oPNCE 0yDYX9FjCkSaB8hhpoWBQjsriNDbsPAptHk/yCBAZpAQ97qwEVb7oMPltOHU317u88w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gN0fJVGr; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB32D606A31B; Thu, 5 Nov 2026 14:45:41 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53F401F000C1; Thu, 5 Nov 2026 14:45:39 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793889941; bh=GXf8t6+kR4HdU5+vFSNIxt3JNXiYtbmrhcPp2vi87yk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=gN0fJVGrutjDiaCK/OwIN5FP3P1bXDzDLpx2L2NnnxLb12q0eiEJrr/qJ1a8n9H0P +0QArjydJvzix9vyXR1mpdzVi5V8CXR40jVi1vhGiMHFmOXtrxgtqUH0aU8Z9o1Fil V8cqAKiY4YtE0S2hcIvsO1vV2XIvUHIywLAQ00Um199J8PAR++EwvyXguTNvRw9sSd E+gmzCc6KdNTd4u6mab6FrJElG38RUn5Z1J7p8DbaSKcDtbA4Qa2ZzcRRXM9fDfv1B BP1ONSzVTPckWUArA6GYUl71jjqEmXscJl5AroUfu7120tY6N8/k5b3akMHzQpzanV LRtyIcHRovM9Q== X-Cc: Aaron Conole <aconole@redhat.com>, Eelco Chaudron <echaudro@redhat.com>, Ilya Maximets <i.maximets@ovn.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261102-ovs-exthdrs-v2-1-21ceef6a243d@gmail.com>