From: Steffen Klassert <steffen.klassert@secunet.com>
To: Paul Chaignon <paul.chaignon@gmail.com>
Cc: <netdev@vger.kernel.org>, <fw@strlen.de>, <pabeni@redhat.com>,
<kuba@kernel.org>,
Louis DeLosSantos <louis.delos.devel@gmail.com>
Subject: Re: [PATCH net] xfrm: Sanitize marks before insert
Date: Thu, 15 May 2025 09:53:48 +0200 [thread overview]
Message-ID: <aCWdjLjehouyturu@gauss3.secunet.de> (raw)
In-Reply-To: <aBtErrG9y1Fb-_wq@mail.gmail.com>
On Wed, May 07, 2025 at 01:31:58PM +0200, Paul Chaignon wrote:
> Prior to this patch, the mark is sanitized (applying the state's mask to
> the state's value) only on inserts when checking if a conflicting XFRM
> state or policy exists.
>
> We discovered in Cilium that this same sanitization does not occur
> in the hot-path __xfrm_state_lookup. In the hot-path, the sk_buff's mark
> is simply compared to the state's value:
>
> if ((mark & x->mark.m) != x->mark.v)
> continue;
>
> Therefore, users can define unsanitized marks (ex. 0xf42/0xf00) which will
> never match any packet.
>
> This commit updates __xfrm_state_insert and xfrm_policy_insert to store
> the sanitized marks, thus removing this footgun.
>
> This has the side effect of changing the ip output, as the
> returned mark will have the mask applied to it when printed.
>
> Fixes: 3d6acfa7641f ("xfrm: SA lookups with mark")
> Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
> Signed-off-by: Louis DeLosSantos <louis.delos.devel@gmail.com>
> Co-developed-by: Louis DeLosSantos <louis.delos.devel@gmail.com>
Applied, thanks a lot!
prev parent reply other threads:[~2025-05-15 8:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 11:31 [PATCH net] xfrm: Sanitize marks before insert Paul Chaignon
2025-05-15 7:53 ` Steffen Klassert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aCWdjLjehouyturu@gauss3.secunet.de \
--to=steffen.klassert@secunet.com \
--cc=fw@strlen.de \
--cc=kuba@kernel.org \
--cc=louis.delos.devel@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paul.chaignon@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.