netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Tobias Brunner <tobias@strongswan.org>, <netdev@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH ipsec] xfrm: Ensure consistent address families when resolving templates
Date: Tue, 25 Apr 2023 08:47:15 +0200	[thread overview]
Message-ID: <ZEd3c8j+ceBvObeM@gauss3.secunet.de> (raw)
In-Reply-To: <ZEdmdDAwnuslrdvA@gondor.apana.org.au>

On Tue, Apr 25, 2023 at 01:34:44PM +0800, Herbert Xu wrote:
> On Mon, Apr 24, 2023 at 03:23:02PM +0200, Tobias Brunner wrote:
> > xfrm_state_find() uses `encap_family` of the current template with
> > the passed local and remote addresses to find a matching state.
> > This check makes sure that there is no mismatch and out-of-bounds
> > read in mixed-family scenarios where optional tunnel or BEET mode
> > templates were skipped that would have changed the addresses to
> > match the current template's family.
> > 
> > This basically enforces the same check as validate_tmpl(), just at
> > runtime when one or more optional templates might have been skipped.
> > 
> > Signed-off-by: Tobias Brunner <tobias@strongswan.org>
> > ---
> >  net/xfrm/xfrm_policy.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> 
> I'm confused.  By skipping, you're presumably referring to IPcomp.
> 
> For IPcomp, skipping should only occur on inbound, but your patch
> is changing a code path that's only invoked for outbound.  What's
> going on?

The problem is, that you can configure it for outbound too.
Even though, it does not make much sense. syzbot reported
a stack-out-of-bounds issue with intermediate optional
templates that change the address family:

https://www.spinics.net/lists/netdev/msg890567.html

I tried to fix this by rejecting such a configuration:

https://lore.kernel.org/netdev/ZCZ79IlUW53XxaVr@gauss3.secunet.de/T/

This broke some strongswan configurations.

Tobias patch is the next attempt to fix that.

  reply	other threads:[~2023-04-25  6:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 13:23 [PATCH ipsec] xfrm: Ensure consistent address families when resolving templates Tobias Brunner
2023-04-25  5:34 ` Herbert Xu
2023-04-25  6:47   ` Steffen Klassert [this message]
2023-04-25  8:26     ` Herbert Xu
2023-04-25  8:00   ` Tobias Brunner
2023-04-25  8:28     ` Herbert Xu
2023-05-05 10:16       ` [PATCH ipsec] xfrm: Reject optional tunnel/BEET mode templates in outbound policies Tobias Brunner
2023-05-05 10:43         ` Herbert Xu
2023-05-05 11:36           ` [PATCH ipsec] af_key: " Tobias Brunner
2023-05-08  3:10             ` Herbert Xu
2023-05-08  6:01             ` Steffen Klassert
2023-05-09  9:00               ` Tobias Brunner
2023-05-11 10:04                 ` Steffen Klassert
2023-05-08  5:59         ` [PATCH ipsec] xfrm: " Steffen Klassert
2023-05-08  9:03           ` Tobias Brunner
2023-05-09  4:27             ` Steffen Klassert
2023-05-09  8:59               ` Tobias Brunner
2023-05-11 10:03                 ` Steffen Klassert

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=ZEd3c8j+ceBvObeM@gauss3.secunet.de \
    --to=steffen.klassert@secunet.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=tobias@strongswan.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).