[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aCWdjLjehouyturu@gauss3.secunet.de>
Date: Thu, 15 May 2025 09:53:48 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Paul Chaignon <paul.chaignon@...il.com>
CC: <netdev@...r.kernel.org>, <fw@...len.de>, <pabeni@...hat.com>,
<kuba@...nel.org>, Louis DeLosSantos <louis.delos.devel@...il.com>
Subject: Re: [PATCH net] xfrm: Sanitize marks before insert
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@...il.com>
> Signed-off-by: Louis DeLosSantos <louis.delos.devel@...il.com>
> Co-developed-by: Louis DeLosSantos <louis.delos.devel@...il.com>
Applied, thanks a lot!
Powered by blists - more mailing lists